本文整理汇总了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
示例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)
示例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)
示例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)
示例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)
示例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)