Home  >  Q&A  >  body text

python - pyqt中QTableWidget的勾选框,怎么获取他的勾选状态?


如图,这个勾选状态应该怎么获取呀?

下面是创建代码,不知道获取代码应该怎么写,求大神指导下

for i in xrange(len(friends)):
    #插入行
    row_count = self.friendTable.rowCount()
    self.friendTable.insertRow(row_count)
    # 插入内容
    # self.friendTable.setItem(0,1, QTableWidgetItem(unicode(friend['NickName'], 'gb2312', 'ignore')))
    #插入单选框
    checkBox = QTableWidgetItem(unicode(friends[i]['UserName']));
    #设置单选框为选中
    checkBox.setCheckState(Qt.Checked);
    self.friendTable.setItem(i,0, checkBox)
    self.friendTable.setItem(i,1, QTableWidgetItem(unicode(friends[i]['NickName'])))
    self.friendTable.setItem(i,2, QTableWidgetItem(unicode(friends[i]['RemarkName'])))
迷茫迷茫2741 days ago579

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-04-18 10:32:30

    Have a look if there is a function similar to getchecked

    reply
    0
  • Cancelreply