Which signal can tell me unchecked checkbox?

936 views Asked by At

Suppose I have set of QCheckBoxes, I set some of them. I need to understand when I uncheck them, but I don't know which signal can help me? The following code tell me checked:

QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL(_fromUtf8("isChecked()")), lambda: self.interfaceCodesConstructor.setFilterDict(self,"name",self.lineEdit.text()))

and I connect a lambda function.

My question is, which signal can tell me checkbox is unchecked?

1

There are 1 answers

0
Shf On BEST ANSWER

How about void QCheckBox::stateChanged ( int state ) [signal], from description :

This signal is emitted whenever the check box's state changes, i.e. whenever the user checks or unchecks it. state contains the check box's new Qt::CheckState.

So after you connect it to slot, just check, if state variable equals Qt::Checked and process your slot, else - return.