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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top