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})
    projectsFindInstance.tableWidget.setCellWidget(row,0,instance)
    projectsFindInstance.tableWidget.setRowCount(projectsFindInstance.tableWidget.rowCount()+1)
    @
    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 "./main.py", line 117, in <module>
    main()
    File "./main.py", line 104, in main
    x.showFindProjects()
    File "/home/mohsen/codes/amlak/amlak/src/UIInterface.py", line 101, in showFindProjects
    self.uiProjectsFind.setupUi(self.projectsFind)
    File "/home/mohsen/codes/amlak/amlak/src/projectsFind.py", 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.