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


Python QStandardItemModel.setItem方法代码示例

本文整理汇总了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)
开发者ID:rouault,项目名称:Quantum-GIS,代码行数:12,代码来源:matrixmodelerwidget.py

示例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)
开发者ID:anitagraser,项目名称:QGIS,代码行数:15,代码来源:matrixmodelerwidget.py

示例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)
开发者ID:rldhont,项目名称:Quantum-GIS,代码行数:16,代码来源:FixedTableDialog.py


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