当前位置: 首页>>代码示例>>Python>>正文


Python QTableWidgetItem.setSizeHint方法代码示例

本文整理汇总了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)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:51,代码来源:EditResidues_PropertyManager.py

示例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
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:77,代码来源:EditResidues_PropertyManager.py


注:本文中的PyQt4.Qt.QTableWidgetItem.setSizeHint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。