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


Python QItemSelection.indexes方法代码示例

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


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

示例1: _restoreSelection

# 需要导入模块: from PyQt4.QtGui import QItemSelection [as 别名]
# 或者: from PyQt4.QtGui.QItemSelection import indexes [as 别名]
 def _restoreSelection(self):
     newSelection = QItemSelection()
     for index in self.model.selected_indexes:
         newSelection.select(self.createIndex(index, 0), self.createIndex(index, 0))
     self.view.selectionModel().select(newSelection, QItemSelectionModel.ClearAndSelect)
     if len(newSelection.indexes()):
         currentIndex = newSelection.indexes()[0]
         self.view.selectionModel().setCurrentIndex(currentIndex, QItemSelectionModel.Current)
         self.view.scrollTo(currentIndex)
开发者ID:glasmasin,项目名称:moneyguru,代码行数:11,代码来源:selectable_list.py

示例2: _updateViewSelection

# 需要导入模块: from PyQt4.QtGui import QItemSelection [as 别名]
# 或者: from PyQt4.QtGui.QItemSelection import indexes [as 别名]
 def _updateViewSelection(self):
     # Takes the selection on the model's side and update the view with it.
     newSelection = QItemSelection()
     columnCount = self.columnCount(QModelIndex())
     for index in self.model.selected_indexes:
         newSelection.select(self.createIndex(index, 0), self.createIndex(index, columnCount-1))
     self.view.selectionModel().select(newSelection, QItemSelectionModel.ClearAndSelect)
     if len(newSelection.indexes()):
         currentIndex = newSelection.indexes()[0]
         self.view.selectionModel().setCurrentIndex(currentIndex, QItemSelectionModel.Current)
         self.view.scrollTo(currentIndex)
开发者ID:prodigeni,项目名称:moneyguru,代码行数:13,代码来源:table.py

示例3: select

# 需要导入模块: from PyQt4.QtGui import QItemSelection [as 别名]
# 或者: from PyQt4.QtGui.QItemSelection import indexes [as 别名]
    def select(self, selection, flags):
        if isinstance(selection, QModelIndex):
            selection = QItemSelection(selection, selection)

        model = self.model()
        indexes = selection.indexes()
        sel_inds = {ind.row() for ind in indexes} | \
                   {ind.column() for ind in indexes}
        if flags == QItemSelectionModel.ClearAndSelect:
            selected = set()
        else:
            selected = {ind.row() for ind in self.selectedIndexes()}
        if flags & QItemSelectionModel.Select:
            selected |= sel_inds
        elif flags & QItemSelectionModel.Deselect:
            selected -= sel_inds
        new_selection = QItemSelection()
        regions = list(ranges(sorted(selected)))
        for r_start, r_end in regions:
            for c_start, c_end in regions:
                top_left = model.index(r_start, c_start)
                bottom_right = model.index(r_end - 1, c_end - 1)
                new_selection.select(top_left, bottom_right)
        QItemSelectionModel.select(self, new_selection,
                                   QItemSelectionModel.ClearAndSelect)
开发者ID:OXPHOS,项目名称:orange3,代码行数:27,代码来源:owdistancematrix.py


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