本文整理匯總了Python中PyQt5.QtCore.QAbstractTableModel.headerData方法的典型用法代碼示例。如果您正苦於以下問題:Python QAbstractTableModel.headerData方法的具體用法?Python QAbstractTableModel.headerData怎麽用?Python QAbstractTableModel.headerData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtCore.QAbstractTableModel
的用法示例。
在下文中一共展示了QAbstractTableModel.headerData方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData(self, section, orientation, role = Qt.DisplayRole):
if role == Qt.DisplayRole:
if orientation == Qt.Horizontal:
return str(self.h_header[section])
elif orientation == Qt.Vertical:
return str(self.v_header[section])
return QAbstractTableModel.headerData(self, section, orientation, role)
示例2: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData(self, section, orientation, role):
"""
Public method to get header data from the model.
@param section section number (integer)
@param orientation orientation (Qt.Orientation)
@param role role of the data to retrieve (integer)
@return requested data
"""
if role == Qt.SizeHintRole:
fm = QFontMetrics(QFont())
height = fm.height() + fm.height() // 3
width = \
fm.width(self.headerData(section, orientation, Qt.DisplayRole))
return QSize(width, height)
if orientation == Qt.Horizontal:
if role == Qt.DisplayRole:
try:
return self.__headers[section]
except IndexError:
return None
return None
return QAbstractTableModel.headerData(self, section, orientation, role)
示例3: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
"""
Public method to get header data from the model.
@param section section number (integer)
@param orientation orientation (Qt.Orientation)
@param role role of the data to retrieve (integer)
@return requested data
"""
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
return self.__headerData[section]
return QAbstractTableModel.headerData(self, section, orientation, role)
示例4: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
"""
Public method to get the header data.
@param section section number (integer)
@param orientation header orientation (Qt.Orientation)
@param role data role (integer)
@return header data
"""
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
try:
return self.__headers[section]
except IndexError:
pass
return QAbstractTableModel.headerData(self, section, orientation, role)
示例5: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
if orientation == Qt.Horizontal and role==Qt.DisplayRole:
return self.infoKeys[section]
return QAbstractTableModel.headerData(self, section, orientation, role)
示例6: headerData
# 需要導入模塊: from PyQt5.QtCore import QAbstractTableModel [as 別名]
# 或者: from PyQt5.QtCore.QAbstractTableModel import headerData [as 別名]
def headerData( self, section, orientation, role=QtCore.Qt.DisplayRole ):
if role == QtCore.Qt.DisplayRole and orientation == QtCore.Qt.Horizontal:
return self.COLUMNS[section]
return QAbstractTableModel.headerData( self, section, orientation, role )