Reputation: 341
I have the following situation in my QT Slot function for stateChanged signal:
void ui::myslot(int state) {
...
if (condition) {
checkbox->setChecked(true);
}
...
}
In case my checkbox is already checked and when I try to uncheck it, given the condition is fulfilled, the checkbox will be checked again. However, when I try to uncheck it again and the condition is still true, it just becomes unchecked with no signals being emitted. Ie, the function above isn't even called...
Any idea what could be happening here?
Thanks a lot! :)
Upvotes: 1
Views: 943
Reputation: 556
Did you try to create a temporary slot, connect it with the stateChanged() signal? For example:
void onStateChanged(int state);
You can define the slot as:
void onStateChanged(int state)
{
qDebug() << "State changed.";
}
Don't forget to include header in the .cpp file. Then connect the slot with the signal and launch the application. If you see "State changed."
in the standard output and the execucution reaches the slot, then the signal is emitted properly.
Upvotes: 0