Reputation: 7799
I'm study C++ Qt. And now try to use lambda function with connect
:
connect(ui->sbNormal, &QSpinBox::valueChanged, [=] (int x) {});
It output error:
error: no matching function for call to 'MainWindow::connect(QSpinBox*&, < unresolved overloaded function type>, MainWindow::MainWindow(QWidget*)::< lambda(int)>)'});
What am I do wrong? How to specify needed overloading?
Upvotes: 1
Views: 100
Reputation: 49319
In case there are multiple overloads, you have to specify which one you want manually:
connect(ui->sbNormal, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
[=] (int x) {});
Upvotes: 4