PySide.QtGui.QItemSelectionModel class keeps track of a view's selected items.
A PySide.QtGui.QItemSelectionModel keeps track of the selected items in a view, or in several views onto the same model. It also keeps track of the currently selected item in a view.
PySide.QtGui.QItemSelectionModel class is one of the 模型/视图类 且属于 Qt 的 模型/视图框架 .
选中项使用范围存储。每当想要修改选中项时,使用 PySide.QtGui.QItemSelectionModel.select() and provide either a PySide.QtGui.QItemSelection ,或 PySide.QtCore.QModelIndex 和 QItemSelectionModel.SelectionFlag .
PySide.QtGui.QItemSelectionModel takes a two layer approach to selection management, dealing with both selected items that have been committed and items that are part of the current selection. The current selected items are part of the current interactive selection (for example with rubber-band selection or keyboard-shift selections).
要更新目前的选中项,使用按位 OR 的 QItemSelectionModel.Current 和任何其它 SelectionFlags 。若省略 QItemSelectionModel.Current command, a new current selection will be created, and the previous one added to the whole selection. All functions operate on both layers; for example, selectedItems() will return items from both layers.
另请参阅
模型/视图编程 PySide.QtCore.QAbstractItemModel 图表范例
| 参数: |
|
|---|
Constructs a selection model that operates on the specified item model .
Constructs a selection model that operates on the specified item model with parent .
此枚举描述将更新选定模型的方式。
| 常量 | 描述 |
|---|---|
| QItemSelectionModel.NoUpdate | No selection will be made. |
| QItemSelectionModel.Clear | The complete selection will be cleared. |
| QItemSelectionModel.Select | 所有指定索引将被选中。 |
| QItemSelectionModel.Deselect | 所有指定索引将被取消选择。 |
| QItemSelectionModel.Toggle | All specified indexes will be selected or deselected depending on their current state. |
| QItemSelectionModel.Current | 当前选定将被更新。 |
| QItemSelectionModel.Rows | 将扩展所有索引以跨行。 |
| QItemSelectionModel.Columns | 将扩展所有索引以跨列。 |
| QItemSelectionModel.SelectCurrent | A combination of Select and Current, provided for convenience. |
| QItemSelectionModel.ToggleCurrent | A combination of Toggle and Current, provided for convenience. |
| QItemSelectionModel.ClearAndSelect | A combination of Clear and Select, provided for convenience. |
清零选定模型。发射 PySide.QtGui.QItemSelectionModel.selectionChanged() and PySide.QtGui.QItemSelectionModel.currentChanged() .
Clears the selection in the selection model. Emits PySide.QtGui.QItemSelectionModel.selectionChanged() .
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Returns true if there are any items selected in the column 采用给定 parent .
| 参数: |
|
|---|
| 参数: |
|
|---|
| 返回类型: | PySide.QtCore.QModelIndex |
|---|
Returns the model item index for the current item, or an invalid index if there is no current item.
| 参数: |
|
|---|
| 参数: |
|
|---|
比较 2 选定 newSelection and oldSelection 并发射 PySide.QtGui.QItemSelectionModel.selectionChanged() with the deselected and selected items.
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the selection model contains any selection ranges; otherwise returns false.
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Returns true if all items are selected in the column 采用给定 parent .
Note that this function is usually faster than calling PySide.QtGui.QItemSelectionModel.isSelected() on all items in the same column and that unselectable items are ignored.
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Returns true if all items are selected in the row 采用给定 parent .
Note that this function is usually faster than calling PySide.QtGui.QItemSelectionModel.isSelected() on all items in the same row and that unselectable items are ignored.
| 参数: | index – PySide.QtCore.QModelIndex |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if the given model item index 被选中。
| 返回类型: | PySide.QtCore.QAbstractItemModel |
|---|
返回由选定模型操作的项模型。
Clears the selection model. Does not emit any signals.
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Returns true if there are any items selected in the row 采用给定 parent .
| 参数: |
|
|---|
| 参数: |
|
|---|
| 参数: | row – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtCore.QModelIndexList |
返回的索引在给定 row 对于选中所有行的列而言。
| 返回类型: | PySide.QtCore.QModelIndexList |
|---|
返回所有选中模型项索引的列表。列表包含的不重复,且未排序。
| 参数: | column – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtCore.QModelIndexList |
返回的索引在给定 column 对于选中所有列的行而言。
| 返回类型: | PySide.QtGui.QItemSelection |
|---|
返回存储在选定模型中的选定范围。
| 参数: |
|
|---|
| 参数: |
|
|---|