Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top