Problem with the QCheckBox
Unsolved
General and Desktop
-
So, when the user ticks the checkbox, I check whether the condition is met or not.
In case the condition is not met, then I reset the checkbox to unticked.
When the user ticks the checkbox again, it really gets ticked, but the signal isn't fired.
Only when the user unticks the ckeckbox again, it will work again.Here are some things that I have tried:
void SLOT_CB_MyCheckbox_STATECHANGED(int state) { if (state && !condition) ui.CB_MyCheckbox->setChecked(false); }
and
void SLOT_CB_MyCheckbox_STATECHANGED(int state) { if (state && !condition) bool oldState = ui.CB_MyCheckbox->blockSignals(true); ui.CB_MyCheckbox->setChecked(true); ui.CB_MyCheckbox->setChecked(false); ui.CB_MyCheckbox->blockSignals(oldState); ui.CB_MyCheckbox->setChecked(false); }
The second code snipped actually worked for some other examples where I needed to set it to some default value in the last line, instead of just
false
.Thanks for the help!
-
Hi,
From a user point of view: why is that check box enabled if the conditions are not met ?
If a checkbox I click on auto-unchecks then it looks like a bug.
-
-
What does
condition
contain ?