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


Python QAbstractTableModel.headerData方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QAbstractTableModel.headerData方法的典型用法代码示例。如果您正苦于以下问题:Python QAbstractTableModel.headerData方法的具体用法?Python QAbstractTableModel.headerData怎么用?Python QAbstractTableModel.headerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QAbstractTableModel的用法示例。


在下文中一共展示了QAbstractTableModel.headerData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
    def headerData (self, section, direction, role=Qt.DisplayRole):
        if direction==Qt.Horizontal and role==Qt.DisplayRole:
            data= QVariant (self.headers[section])
        elif direction==Qt.Vertical:
            if role==Qt.SizeHintRole:
                # TODO: support bold fonts
                # again, hacky. 5 for enough witdh for 5 digits
                size= self.fontMetrics.size (Qt.TextSingleLine, "M"*5)
                data= QVariant (size)
            elif role==Qt.TextAlignmentRole:
                data= QVariant (Qt.AlignRight|Qt.AlignVCenter)
            else:
                data= QAbstractTableModel.headerData (self, section, direction, role)
        else:
            data= QAbstractTableModel.headerData (self, section, direction, role)

        return data
开发者ID:StyXman,项目名称:satyr,代码行数:19,代码来源:complex.py

示例2: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
 def headerData (self, col , orientation, role = QtCore.Qt.DisplayRole):
     
     if col >= self.cCount and orientation==QtCore.Qt.Horizontal:
         return QVariant();
     if role == QtCore.Qt.ForegroundRole and orientation==QtCore.Qt.Horizontal and self.restApi == 'liststockdayinfo':
         if  col == self.columnNames.index('growth_ratio') or \
             col == self.columnNames.index('turnover_ratio') or \
             col == self.columnNames.index('amplitude_ratio') or \
             col == self.columnNames.index('volume_ratio') or \
             col == self.columnNames.index('avg_price') or \
             col == self.columnNames.index('total_money') or \
             col == self.columnNames.index('stockid') or \
             col == self.columnNames.index('created'):
                 return QVariant(QtGui.QColor(255,0,0));
     if(role==QtCore.Qt.DisplayRole and orientation==QtCore.Qt.Horizontal) :
         return QVariant(self.headers[col]);  
     return QAbstractTableModel.headerData(self, col,orientation,role)
开发者ID:liumin0,项目名称:stockii_client,代码行数:19,代码来源:customModel.py

示例3: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
 def headerData(self, section, orientation, role=Qt.DisplayRole):
     if role == Qt.DisplayRole and orientation == Qt.Horizontal:
         return CatalogAcquisition.COLUMNS[section].name
     return QAbstractTableModel.headerData(self, section, orientation, role)
开发者ID:DigitalGlobe,项目名称:DGConnect,代码行数:6,代码来源:CatalogDialogTool.py

示例4: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
 def headerData (self, col , orientation, role):
     if(role==QtCore.Qt.DisplayRole and orientation==QtCore.Qt.Horizontal) :
         return self.headers[col];  
     return QAbstractTableModel.headerData(self, col,orientation,role)
开发者ID:liumin0,项目名称:stockii_client,代码行数:6,代码来源:tableModel_bak.py

示例5: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
 def headerData(self, section, orientation, role=Qt.DisplayRole):
     if role == Qt.DisplayRole and orientation == Qt.Horizontal:
         return self.header_labels[section]
     return QAbstractTableModel.headerData(self, section, orientation, role)
开发者ID:raphaelrpl,项目名称:wcsviewer,代码行数:6,代码来源:utils.py

示例6: headerData

# 需要导入模块: from PyQt4.QtCore import QAbstractTableModel [as 别名]
# 或者: from PyQt4.QtCore.QAbstractTableModel import headerData [as 别名]
 def headerData(self, section, orientation, role):
     if role == Qt.DisplayRole and orientation == Qt.Horizontal:
         return QVariant(self.columns_names[section])
     else:
         return QAbstractTableModel.headerData(self, section, orientation, role)
开发者ID:BStalewski,项目名称:lanler,代码行数:7,代码来源:main_model.py


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