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


Python QtCore.QModelIndex方法代码示例

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


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

示例1: add_testresults

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def add_testresults(self, new_tests):
        """
        Add new test results to the model.

        Arguments
        ---------
        new_tests : list of TestResult
        """
        firstRow = len(self.testresults)
        lastRow = firstRow + len(new_tests) - 1
        for test in new_tests:
            self.abbreviator.add(test.name)
        self.beginInsertRows(QModelIndex(), firstRow, lastRow)
        self.testresults.extend(new_tests)
        self.endInsertRows()
        self.emit_summary() 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:18,代码来源:datatree.py

示例2: data

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def data(self, index, role):
        """
        Re-implemented to return the icon for the current index.

        Parameters
        ----------
        index : QtCore.QModelIndex
        role : int

        Returns
        -------
        Any
        """
        if role == QtCore.Qt.DecorationRole:
            iconString = self.data(index, role=QtCore.Qt.DisplayRole)
            return qtawesome.icon(iconString, color=self._iconColor)
        return super().data(index, role) 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:19,代码来源:icon_browser.py

示例3: index

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def index(self, row, column, parent=QModelIndex()):
        """
        Construct index to given item of data.

        If `parent` not valid, then the item of data is on the top level.
        """
        if not self.hasIndex(row, column, parent):  # check bounds etc.
            return QModelIndex()
        if not parent.isValid():
            return self.createIndex(row, column, TOPLEVEL_ID)
        else:
            testresult_index = parent.row()
            return self.createIndex(row, column, testresult_index) 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:15,代码来源:datatree.py

示例4: parent

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def parent(self, index):
        """Return index to parent of item that `index` points to."""
        if not index.isValid():
            return QModelIndex()
        id = index.internalId()
        if id == TOPLEVEL_ID:
            return QModelIndex()
        else:
            return self.index(id, 0) 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:11,代码来源:datatree.py

示例5: rowCount

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def rowCount(self, parent=QModelIndex()):
        """Return number of rows underneath `parent`."""
        if not parent.isValid():
            return len(self.testresults)
        if parent.internalId() == TOPLEVEL_ID and parent.column() == 0:
            return len(self.testresults[parent.row()].extra_text)
        return 0 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:9,代码来源:datatree.py

示例6: columnCount

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def columnCount(self, parent=QModelIndex()):
        """Return number of rcolumns underneath `parent`."""
        if not parent.isValid():
            return len(HEADERS)
        else:
            return 1 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:8,代码来源:datatree.py

示例7: index

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def index(self, row, column, parent):
        if not self.hasIndex(row, column, parent):
            return QtCore.QModelIndex()

        if not parent.isValid():
            parentItem = self.rootItem
        else:
            parentItem = parent.internalPointer()

        childItem = parentItem.childItems[row]
        if childItem:
            return self.createIndex(row, column, childItem)
        else:
            return QtCore.QModelIndex() 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:16,代码来源:DepotClientViewModel.py

示例8: parent

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def parent(self, index):
        if not index.isValid():
            return QtCore.QModelIndex()
        parentItem = index.internalPointer().parentItem
        if parentItem == self.rootItem:
            return QtCore.QModelIndex()
        return self.createIndex(parentItem.row(), 0, parentItem) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:9,代码来源:DepotClientViewModel.py

示例9: rowCount

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def rowCount(self, index=QModelIndex()):
        """Override Qt method."""
        return len(self._rows) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:5,代码来源:dependencies.py

示例10: columnCount

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QModelIndex [as 别名]
def columnCount(self, index=QModelIndex()):
        """Override Qt method."""
        return 4 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:5,代码来源:dependencies.py


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