本文整理汇总了Python中PyQt4.Qt.QTableWidgetItem.setCheckState方法的典型用法代码示例。如果您正苦于以下问题:Python QTableWidgetItem.setCheckState方法的具体用法?Python QTableWidgetItem.setCheckState怎么用?Python QTableWidgetItem.setCheckState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem.setCheckState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: actualizarCompeticiones
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setCheckState [as 别名]
def actualizarCompeticiones(self):
cont = 0
self.tbCompeticion.setRowCount(0)
for k in self.listaCompeticiones:
self.tbCompeticion.setRowCount(self.tbCompeticion.rowCount()+1)
nameFile = str(k[5])+'.png'
dirIco = str(self.config.profile('INFO_GENERAL','DIRRECURSOS'))+'/flags/'+nameFile
itemBandera = QTableWidgetItem(QIcon(dirIco),"",1)
competicion = self.existComp(k[1])
itemCompeticionT = QTableWidgetItem()
if competicion:
itemBandera.setCheckState(Qt.Checked)
itemCompeticionT.setData(Qt.DisplayRole,competicion)
else:
itemBandera.setCheckState(Qt.Unchecked)
itemCompeticionT.setData(Qt.DisplayRole,"")
itemBandera.setData(Qt.DisplayRole,"")
self.tbCompeticion.setItem(cont, 0,itemBandera)
self.tbCompeticion.setItem(cont, 2,itemCompeticionT)
itemCompeticion = QTableWidgetItem()
itemCompeticion.setData(Qt.DisplayRole,k[1])
self.tbCompeticion.setItem(cont, 1,itemCompeticion)
itemID = QTableWidgetItem()
itemID.setData(Qt.DisplayRole,k[0])
self.tbCompeticion.setItem(cont, 3,itemID)
cont += 1
self.tbCompeticion.selectRow(self.rowCompSelected)
示例2: _makeCheckItem
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setCheckState [as 别名]
def _makeCheckItem(self, name, group, attr):
item = QTableWidgetItem(name)
if group is self.model.defgroup:
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
item.setCheckState(Qt.Checked if getattr(group.style, attr) else Qt.Unchecked)
else:
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsTristate)
item.setCheckState(self.ShowAttrToCheckState[getattr(group.style, attr)])
return item
示例3: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setCheckState [as 别名]
def _fillSequenceTable(self):
"""
"""
self.setComboBox = QComboBox()
for chunk in self.win.assy.molecules:
if chunk.isProteinChunk():
aa_list = chunk.protein.get_amino_acids()
aa_list_len = len(aa_list)
self.sequenceTable.setRowCount(aa_list_len)
for index in range(aa_list_len):
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
item_widget.setCheckState(Qt.Checked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 0, item_widget)
item_widget = QTableWidgetItem(str(index+1))
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 1, item_widget)
item_widget = QTableWidgetItem("Any")
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 2, item_widget)
aa_string = self._get_mutation_descriptor(
self._get_aa_for_index(index))
item_widget = QTableWidgetItem(aa_string)
item_widget.setFont(self.descriptorfont)
self.sequenceTable.setItem(index, 3, item_widget)
self.sequenceTable.setRowHeight(index, 16)
self.win.connect(self.sequenceTable,
SIGNAL("cellClicked(int, int)"),
self._sequenceTableCellChanged)
self.sequenceTable.resizeColumnsToContents()
self.sequenceTable.setColumnWidth(0, 35)
self.sequenceTable.setColumnWidth(2, 80)
示例4: __init__
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setCheckState [as 别名]
def __init__(self, parent, items):
QDialog.__init__(self, parent)
Ui_DeleteMatchingFromDeviceDialog.__init__(self)
self.setupUi(self)
self.explanation.setText('<p>'+_('All checked books will be '
'<b>permanently deleted</b> from your '
'device. Please verify the list.')+'</p>')
self.buttonBox.accepted.connect(self.accepted)
self.buttonBox.rejected.connect(self.rejected)
self.table.cellClicked.connect(self.cell_clicked)
self.table.setSelectionMode(QAbstractItemView.NoSelection)
self.table.setColumnCount(7)
self.table.setHorizontalHeaderLabels(
['', _('Location'), _('Title'), _('Author'),
_('Date'), _('Format'), _('Path')])
rows = 0
for card in items:
rows += len(items[card][1])
self.table.setRowCount(rows)
row = 0
for card in items:
(model,books) = items[card]
for (id,book) in books:
item = QTableWidgetItem()
item.setFlags(Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
item.setCheckState(Qt.Checked)
item.setData(Qt.UserRole, (model, id, book.path))
self.table.setItem(row, 0, item)
self.table.setItem(row, 1, tableItem(card))
self.table.setItem(row, 2, titleTableItem(book.title))
self.table.setItem(row, 3, authorTableItem(book))
self.table.setItem(row, 4, dateTableItem(book.datetime))
self.table.setItem(row, 5, centeredTableItem(book.path.rpartition('.')[2]))
self.table.setItem(row, 6, tableItem(book.path))
row += 1
self.table.setCurrentCell(0, 1)
self.table.resizeColumnsToContents()
self.table.setSortingEnabled(True)
self.table.sortByColumn(2, Qt.AscendingOrder)
self.table.setCurrentCell(0, 1)
示例5: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setCheckState [as 别名]
def _fillSequenceTable(self):
"""
Fills in the sequence table.
"""
if not self.current_protein:
return
else:
currentProteinChunk = self.current_protein
self.editingItem = True
aa_list = currentProteinChunk.protein.get_amino_acids()
aa_list_len = len(aa_list)
self.sequenceTable.setRowCount(aa_list_len)
for index in range(aa_list_len):
# Selection checkbox column
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
item_widget.setCheckState(Qt.Checked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 0, item_widget)
# Amino acid index column
item_widget = QTableWidgetItem(str(index+1))
item_widget.setFont(self.labelfont)
item_widget.setFlags(
Qt.ItemIsSelectable |
Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 1, item_widget)
# Mutation descriptor name column
aa = self._get_aa_for_index(index)
item_widget = QTableWidgetItem(self._get_descriptor_name(aa))
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 2, item_widget)
# Backrub checkbox column
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
if aa.get_backrub_mode():
item_widget.setCheckState(Qt.Checked)
else:
item_widget.setCheckState(Qt.Unchecked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 3, item_widget)
# Mutation descriptor column
aa_string = self._get_mutation_descriptor(aa)
item_widget = QTableWidgetItem(aa_string)
item_widget.setFont(self.descriptorfont)
self.sequenceTable.setItem(index, 4, item_widget)
self.sequenceTable.setRowHeight(index, 16)
self.editingItem = False
self.sequenceTable.resizeColumnsToContents()
self.sequenceTable.setColumnWidth(0, 35)
self.sequenceTable.setColumnWidth(2, 80)
self.sequenceTable.setColumnWidth(3, 35)
return