Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCheckBox send first item or last item
Qt 6.11 is out! See what's new in the release blog

QCheckBox send first item or last item

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 873 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    m_pahlevanzadeh
    wrote on last edited by
    #1

    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)
    projectsFindInstance.projectsInstance.addOnFieldsInstance.update({uniqueFields[row]:instance})
    projectsFindInstance.tableWidget.setRowCount(projectsFindInstance.tableWidget.rowCount()+1)
    projectsFindInstance.tableWidget.setCellWidget(row,0,instance)
    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved