[Solved] Assigning custom value to a check- or radiobox
-
Consider the following two snippes;
@value_t value;
value = mUI.radioGroup->checkedButton().value(); // or something similar@
vs
@value_t value;
if ( mUI.radioBtn1->isChecked() )
{
value = value1;
}
else if ( mUI.radioBtn2->isChecked() )
{
value = value2;
}
else
{
value = value3;
}@The latter works, the former does not. Am I correct in that Qt does not provide us with a way of assigning an arbitrary value to a check- or radioBox? If so, why not? So far, my group consists of just three buttons but I can see how this quickly becomes a mess when the count goes up.
-
Hi,
You can use a "dynamic property":http://qt-project.org/doc/qt-5/properties.html#dynamic-properties for that.
-
[quote author="SGaist" date="1415574377"]Hi,
You can use a "dynamic property":http://qt-project.org/doc/qt-5/properties.html#dynamic-properties for that. [/quote]
Exactly what I was looking for. Thank you. :)
-
You're welcome !
Since you have your software working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)