I'm using the new syntax for Signal/Slot connections. It works fine for me, except when I try to connect a signal that's overloaded.
MyClass : public QWidget { Q_OBJECT public: void setup() { QComboBox* myBox = new QComboBox( this ); // add stuff connect( myBox, &QComboBox::currentIndexChanged, [=]( int ix ) { emit( changedIndex( ix ) ); } ); // no dice connect( myBox, &QComboBox::editTextChanged, [=]( const QString& str ) { emit( textChanged( str ) ); } ); // this compiles } private: signals: void changedIndex( int ); void textChanged( const QString& ); };
The difference is currentIndexChanged is overloaded (int, and const QString& types) but editTextChanged is not. The non-overloaded signal connects fine. The overloaded one doesn't. I guess I'm missing something? With GCC 4.9.1, the error I get is
no matching function for call to ‘MyClass::connect(QComboBox*&, <unresolved overloaded function type>, MyClass::setup()::<lambda()>)’