QSpinBox has two signals with the same name
void valueChanged(int i)
void valueChanged(const QString &text)
When used like this
QObject::connect(&spinBox, SIGNAL(valueChanged(int)), ...)
QObject::connect(&spinBox, SIGNAL(valueChanged(QString)), ...)
is no problem.
When using syntax above C++11:
QObject::connect(&spinBox, &QSpinBox::valueChanged, ...)
The compiler will report an error:
error: no matching function for call to QObject::connect(QSpinBox*&, < unresolved overloaded function type>, ...)
The two signals cannot be distinguished using the function name.
At this time, you can use
auto qOverload(T functionPointer)
rewrite as
connect(spinbox, qOverload<int>(&QSpinBox::valueChanged), ...)
Similar Posts:
- [Solved] Qt-network.ssl error: qt.network.ssl: QSslSocket: cannot call unresolved function
- invalid conversion from ‘void* (*)()’ to ‘void* (*)(void*)’
- timer_create ,timer_settime,timer_delete
- [Solved] Operator overload must take either zero or one argument error
- QT Compilation error: invalid application of ‘sizeof’ to incomplete type ‘Qt3DRender::QPickEvent’
- Windows: SQL lab error “module object has no attribute sigalrm”
- Pychorm prompts the unresolved reference import module to report an error
- Qt undefined reference to `vtable for * * * ‘
- Error LNK2019: unresolved external symbol WinMain (vs2019)