Important: Please read the Qt Code of Conduct -

QCheckBox send first item or last item

  • Dear all,

    I have QTableWidget , and each cell of it, is a QCheckBox, i store QCheclBox obejct in a dicitionary, and i call connect function such as:
    for key, val in self.projectsInstance.addOnFieldsInstance.items():
    QtCore.QObject.connect(val, QtCore.SIGNAL("stateChanged (int)"), lambda: self.projectsInstance.setFilterDict_Find("TWCH",self,key,val.checkState(),val))
    When i use the folloiwng code in above for:
    @print "%s %s" % (key,val) # key is string of QCheckBox and val is its Object@
    I get the following result:
    @ssss,<PyQt4.QtGui.QCheckBox object at 0x9feec8c>
    wdds,<PyQt4.QtGui.QCheckBox object at 0xa0c392c>
    kkld,<PyQt4.QtGui.QCheckBox object at 0x9feebb4>
    dfdfkfldfk,<PyQt4.QtGui.QCheckBox object at 0x9feeb6c>
    cccxc,<PyQt4.QtGui.QCheckBox object at 0x9feecd4>
    mmdfmd,<PyQt4.QtGui.QCheckBox object at 0x9feea04>

    First column is text of QCheckbox and i can see them, But my problem is:
    last line:
    @mmdfmd,<PyQt4.QtGui.QCheckBox object at 0x9feea04>@
    All of CheckBoxes set to this Object with their text such as :
    @ssss with <PyQt4.QtGui.QCheckBox object at 0x9feea04>
    wdds with <PyQt4.QtGui.QCheckBox object at 0x9feea04>
    kkld with <PyQt4.QtGui.QCheckBox object at 0x9feea04>
    and so on.
    sound like, connect function set last val object,

    Do you have any idea?

    By the way , i insert QCheckbox objects with the following code:
    @ #the folloiwng code is just for loop
    for row in xrange(len(uniqueFields) - 1 ):
    instance = QtGui.QCheckBox(uniqueFields[row],projectsFindInstance.tableWidget)

Log in to reply