We have a QCheckBox
object, when user checks it or removes check we want to call a function so we connect our function to stateChanged ( int state )
In QObject
derived classes, you can call blockSignals(bool)
to prevent the object from emitting signals. So for example:
void customChangeState(bool checked)
{
blockSignals(true);
ui->checkBox->setCheckState(Qt::Checked);
// other work
blockSignals(false);
}
The above method would change the check state without clicked, stateChanged
, or any other signals being emitted.