Important: Please read the Qt Code of Conduct -

Object type and how to fetch it

  • Dear all,

    I filled up a dict : {checkboxString:ItsObejct} such as:
    @ for row in xrange(len(uniqueFields)):
    instance = QtGui.QCheckBox(uniqueFields[row])
    projectsFindInstance.projectsInstance.addOnFieldsInstance.update({"%s" % uniqueFields[row]:instance})
    Then i wrote a loop for connect function:
    @ for key, val in self.projectsInstance.addOnFieldsInstance.items():
    instance = getattr(self,"%s" % self.projectsInstance.addOnFieldsInstance.get(key))
    QtCore.QObject.connect(instance, QtCore.SIGNAL(_fromUtf8("stateChanged (int)")),
    lambda: self.projectsInstance.setFilterDict_Find("TWCH",self,"addonfields",instance.CheckState(),instance))
    Then i got the following traceback:

    @Traceback (most recent call last):
    File "./", line 117, in <module>
    File "./", line 104, in main
    File "/home/mohsen/codes/amlak/amlak/src/", line 101, in showFindProjects
    File "/home/mohsen/codes/amlak/amlak/src/", line 267, in setupUi
    instance = getattr(self,"%s" % self.projectsInstance.addOnFieldsInstance.get(key))
    AttributeError: 'Ui_ProjectsFind' object has no attribute '<PyQt4.QtGui.QCheckBox object at 0x96b5d64>'
    value of each item of dict is an obejct of QCheckBox, hwo i access them?

Log in to reply