Connect slider and line edit??
-
If you can use Qt5 and C++11
connect(ui->lightOff_R_LE, &QLineEdit::textChanged, [this](const QString& val)->void{ui->lightOff_R_S->setValue(val.toInt());}); connect(ui->lightOff_R_S, &QSlider::valueChanged,[this](const int& val)->void{ui->lightOff_R_LE->setText(locale().toString(val));});
-
@VRonin do you know how do bypass this error message?
connect(ui->ambCoef, &QSpinBox::valueChanged, [this](const double& value) {emit updateAmbCoef(value); });
it says it is not clear what instance of the overloaded function valueChanged should be used
-
connect(ui->ambCoef, qOverload<double>(&QDoubleSpinBox::valueChanged), [this](const double& value) {emit updateAmbCoef(value); });
or if you are using qt<5.7
connect(ui->ambCoef, ststic_cast<void (&QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](const double& value) {emit updateAmbCoef(value); });
References:
https://wiki.qt.io/New_Signal_Slot_Syntax -
@VRonin both do not work
just see you had a typo.
static_cast<void (QDoubleSpinBox::*)(double)>
instead of
static_cast<void (&QDoubleSpinBox::*)(double)>
-
doublespinbox. I found the problem. see my edit above
-
Out of curiosity, why use a lambda in that case and not signal forwarding ?
-
Because it does not work. I get qstring and need into and the other way around.
-
But why use QLineEdit if you are only manipulating numbers ? That makes the code uselessly complicated.