I have a list of functions with parameters. For each parameter I create a spinbox holding its value. Some functions have zero parameters others have n>1 parameters.
The code looks like this (simplified)
for (int i = 0; i < parameterList.size(); ++i) {
QString valueName = parameterList().at(i);
double value = parameter(valueName);
QDoubleSpinBox * spinbox = new QDoubleSpinBox();
QLabel * label = new QLabel();
label->setText(valueName);
spinbox->setValue(value);
// does NOT work, Slot need three parameters!
QObject::connect(spinbox, &QDoubleSpinBox::valueChanged,
this, &OnAmplitudeParameterChanged);
... add widgets to layout
}
However the slot needs to know which widgets was calling, the parameter name and its value. The signal however provides only a value.
The slot looks like this
OnAmplitudeParameterChanged(int index, QString name, double value)
How is this solved in Qt? I found a QSignalMapper class but not how this would solve my problem.