event connect not honoring default value of handler
Unsolved
General and Desktop
-
I have a button that I have tied to an event that has a default value. like so:
here's the event:
connect(gaugeDivisions1SpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &Window::divisions1Changed);
here's the slot definition:
private slots: void divisions1Changed(bool color = false);
and here's the actual event code:
void Window::divisions1Changed(bool Color) { QColor pColor = Qt::black; if (Color) pColor = getColor(); renderArea->setDivisions1(gaugeDivisions1SpinBox->value(), gaugeDivisions1InnerRadiusSpinBox->value(), gaugeDivisions1OuterRadiusSpinBox->value(), gaugeDivisions1WidthSpinBox->value(), pColor); }
When I click the spinbox, the Color bool value comes across as true. but if I call the event otherwise with no parameter...Color is correctly assumed false. What am I doing wrong? Anyone have any ideas?
-
@RobbieP said in event connect not honoring default value of handler:
Signalvoid QSpinBox::valueChanged(int i)
--- and yourconnect()
toQOverload<int>::of(&QSpinBox::valueChanged)
---sendsi
as parameter, you let that through to your slotvoid divisions1Changed(bool color = false)
as the value ofcolor
. Change your slot to match, or munch thei
parameter in a lambda.