本文整理汇总了Python中qgis.PyQt.QtGui.QStandardItemModel.setItem方法的典型用法代码示例。如果您正苦于以下问题:Python QStandardItemModel.setItem方法的具体用法?Python QStandardItemModel.setItem怎么用?Python QStandardItemModel.setItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtGui.QStandardItemModel
的用法示例。
在下文中一共展示了QStandardItemModel.setItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setValue
# 需要导入模块: from qgis.PyQt.QtGui import QStandardItemModel [as 别名]
# 或者: from qgis.PyQt.QtGui.QStandardItemModel import setItem [as 别名]
def setValue(self, table):
cols = len(table[0])
rows = len(table)
model = QStandardItemModel(rows, cols)
for i in range(rows):
for j in range(cols):
item = QStandardItem(str(table[i][j]))
model.setItem(i, j, item)
self.tblView.setModel(model)
示例2: setValue
# 需要导入模块: from qgis.PyQt.QtGui import QStandardItemModel [as 别名]
# 或者: from qgis.PyQt.QtGui.QStandardItemModel import setItem [as 别名]
def setValue(self, headers, table):
model = self.tblView.model()
model.setHorizontalHeaderLabels(headers)
cols = len(headers)
rows = len(table) // cols
model = QStandardItemModel(rows, cols)
for row in range(rows):
for col in range(cols):
item = QStandardItem(str(table[row * cols + col]))
model.setItem(row, col, item)
self.tblView.setModel(model)
示例3: populateTable
# 需要导入模块: from qgis.PyQt.QtGui import QStandardItemModel [as 别名]
# 或者: from qgis.PyQt.QtGui.QStandardItemModel import setItem [as 别名]
def populateTable(self, table):
cols = len(self.param.headers())
rows = len(table) // cols
model = QStandardItemModel(rows, cols)
# Set headers
model.setHorizontalHeaderLabels(self.param.headers())
# Populate table
for row in range(rows):
for col in range(cols):
item = QStandardItem(str(table[row * cols + col]))
model.setItem(row, col, item)
self.tblView.setModel(model)