In Qt5 and using a C++11-enabled compiler, you can use lambdas as slots, as explained here:
connect(sender, SIGNAL(signal(QString)), [](QString newComboxBoxText) {
// add your code here
});
Otherwise, you can use sender()
to query the QObject*
which sent the signal, if this is enough information you need. To cast it to a QComboBox*
please use qobject_cast<QComboBox*>
and Q_ASSERT
that it's not null. (You can't get a compile-time error that it was connected to some other type.)