本文整理汇总了Python中PyQt4.Qt.QTableWidgetItem.setSizeHint方法的典型用法代码示例。如果您正苦于以下问题:Python QTableWidgetItem.setSizeHint方法的具体用法?Python QTableWidgetItem.setSizeHint怎么用?Python QTableWidgetItem.setSizeHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem.setSizeHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setSizeHint [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)
示例2: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setSizeHint [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