本文整理汇总了Python中AnyQt.QtCore.QItemSelection.append方法的典型用法代码示例。如果您正苦于以下问题:Python QItemSelection.append方法的具体用法?Python QItemSelection.append怎么用?Python QItemSelection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtCore.QItemSelection
的用法示例。
在下文中一共展示了QItemSelection.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: autoSelection
# 需要导入模块: from AnyQt.QtCore import QItemSelection [as 别名]
# 或者: from AnyQt.QtCore.QItemSelection import append [as 别名]
def autoSelection(self):
selModel = self.ranksView.selectionModel()
rowCount = self.ranksModel.rowCount()
columnCount = self.ranksModel.columnCount()
model = self.ranksProxyModel
if self.selectMethod == OWRank.SelectNone:
selection = QItemSelection()
elif self.selectMethod == OWRank.SelectAll:
selection = QItemSelection(
model.index(0, 0),
model.index(rowCount - 1, columnCount - 1)
)
elif self.selectMethod == OWRank.SelectNBest:
nSelected = min(self.nSelected, rowCount)
selection = QItemSelection(
model.index(0, 0),
model.index(nSelected - 1, columnCount - 1)
)
else:
selection = QItemSelection()
if len(self.selected_rows):
selection = QItemSelection()
for row in self.selected_rows:
selection.append(QItemSelectionRange(
model.index(row, 0), model.index(row, columnCount - 1)))
selModel.select(selection, QItemSelectionModel.ClearAndSelect)
示例2: __restore_selection
# 需要导入模块: from AnyQt.QtCore import QItemSelection [as 别名]
# 或者: from AnyQt.QtCore.QItemSelection import append [as 别名]
def __restore_selection(self):
"""Restore the selection on the table view from saved settings."""
selection_model = self.table_view.selectionModel()
selection = QItemSelection()
if len(self.selected_rows):
for row in self.model.mapFromSourceRows(self.selected_rows):
selection.append(QItemSelectionRange(
self.model.index(row, 0),
self.model.index(row, self.model.columnCount() - 1)
))
selection_model.select(selection, QItemSelectionModel.ClearAndSelect)
示例3: select_rows
# 需要导入模块: from AnyQt.QtCore import QItemSelection [as 别名]
# 或者: from AnyQt.QtCore.QItemSelection import append [as 别名]
def select_rows(rows: List[int], widget: OWFeatureStatistics):
"""Since the widget sorts the rows, selecting rows isn't trivial."""
indices = widget.model.mapToSourceRows(rows)
selection = QItemSelection()
for idx in indices:
selection.append(QItemSelectionRange(
widget.model.index(idx, 0),
widget.model.index(idx, widget.model.columnCount() - 1)
))
widget.table_view.selectionModel().select(
selection, QItemSelectionModel.ClearAndSelect)
示例4: set_selection
# 需要导入模块: from AnyQt.QtCore import QItemSelection [as 别名]
# 或者: from AnyQt.QtCore.QItemSelection import append [as 别名]
def set_selection(self):
view = self.doc_list
if len(self.selection):
selection = QItemSelection()
for row in self.selection:
selection.append(
QItemSelectionRange(
view.model().index(row, 0),
view.model().index(row, 0)
)
)
view.selectionModel().select(
selection, QItemSelectionModel.ClearAndSelect)
示例5: set_selection
# 需要导入模块: from AnyQt.QtCore import QItemSelection [as 别名]
# 或者: from AnyQt.QtCore.QItemSelection import append [as 别名]
def set_selection(self):
if len(self.selected_rows) and len(self.selected_cols):
view = self.tabs.currentWidget()
model = view.model()
if model.rowCount() <= self.selected_rows[-1] or \
model.columnCount() <= self.selected_cols[-1]:
return
selection = QItemSelection()
rowranges = list(ranges(self.selected_rows))
colranges = list(ranges(self.selected_cols))
for rowstart, rowend in rowranges:
for colstart, colend in colranges:
selection.append(
QItemSelectionRange(
view.model().index(rowstart, colstart),
view.model().index(rowend - 1, colend - 1)
)
)
view.selectionModel().select(
selection, QItemSelectionModel.ClearAndSelect)