Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QComboBox connect with lamba error
Qt 6.11 is out! See what's new in the release blog

QComboBox connect with lamba error

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dohisev
    wrote on last edited by Dohisev
    #1
    connect(mComboBox, &QComboBox::currentIndexChanged, [&]() {
        // ...
    });
    

    error: C2664: 'QMetaObject::Connection QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType) const': cannot convert argument 2 from 'overloaded-function' to 'const char *'

    JonBJ 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      http://doc.qt.io/qt-5/qcombobox.html#currentIndexChanged

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • D Dohisev
        connect(mComboBox, &QComboBox::currentIndexChanged, [&]() {
            // ...
        });
        

        error: C2664: 'QMetaObject::Connection QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType) const': cannot convert argument 2 from 'overloaded-function' to 'const char *'

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @Dohisev
        and http://doc.qt.io/qt-5/signalsandslots-syntaxes.html or https://asmaloney.com/2016/03/code/using-c11-lambdas-as-qt-slots/ for Lambdas?

        VRoninV 1 Reply Last reply
        0
        • JonBJ JonB

          @Dohisev
          and http://doc.qt.io/qt-5/signalsandslots-syntaxes.html or https://asmaloney.com/2016/03/code/using-c11-lambdas-as-qt-slots/ for Lambdas?

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          To point you exactly in the specific place of @JNBarchan 's liks: http://doc.qt.io/qt-5/signalsandslots-syntaxes.html#selecting-overloaded-signals-and-slots

          If your compiler supports C++14 you can use qOverload()

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          2
          • D Offline
            D Offline
            Dohisev
            wrote on last edited by
            #5

            Thank you guys <3

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved