當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。