ItemSelectionModel QML 类型

实例化 QItemSelectionModel 以用于结合 QAbstractItemModel 及支持它的任何视图。 更多...

import 语句: import QtQml.Models 2.2
Since: Qt 5.5
实例化: QItemSelectionModel

特性

信号

方法

详细描述

另请参阅 QItemSelectionModel and Models and Views in Qt Quick .

特性文档编制

[read-only] currentIndex : QModelIndex

使用 setCurrentIndex() to set its value.

另请参阅 setCurrentIndex() and currentChanged() .

[read-only] hasSelection : bool

It will trigger property binding updates every time selectionChanged() is emitted, even though its value hasn't changed.

另请参阅 selection , selectedIndexes , select() ,和 selectionChanged() .

model : QAbstractItemModel

This property's value must match the view's model.

[read-only] selectedIndexes : QModelIndexList

Contains the list of all the indexes in the selection model.

[read-only] selection : 对象

Holds the selection ranges stored in the selection model.


信号文档编制

currentChanged ( QModelIndex current , QModelIndex previous )

此信号被发射每当当前项改变。 previous model item index is replaced by the current index as the selection's current item.

Note that this signal will not be emitted when the item model is reset.

注意: 相应处理程序是 onCurrentChanged .

另请参阅 currentIndex , setCurrentIndex() ,和 selectionChanged() .

selectionChanged ( QItemSelection selected , QItemSelection deselected )

This signal is emitted whenever the selection changes. The change in the selection is represented as an item selection of deselected items and an item selection of selected 项。

Note the that the current index changes independently from the selection. Also note that this signal will not be emitted when the item model is reset.

注意: 相应处理程序是 onSelectionChanged .

另请参阅 select() and currentChanged() .


方法文档编制

void clear ()

清零选定模型。发射 selectionChanged() and currentChanged() .

void clearCurrentIndex ()

清零当前索引。发射 currentChanged() .

void clearSelection ()

Clears the selection in the selection model. Emits selectionChanged() .

bool columnIntersectsSelection ( int column , QModelIndex parent )

返回 true 若有选中任何项在 column 采用给定 parent .

bool isColumnSelected ( int column , QModelIndex parent )

返回 true if all items are selected in the column 采用给定 parent .

Note that this function is usually faster than calling isSelected() on all items in the same column, and that unselectable items are ignored.

bool isRowSelected ( int row , QModelIndex parent )

返回 true if all items are selected in the row 采用给定 parent .

Note that this function is usually faster than calling isSelected() on all items in the same row, and that unselectable items are ignored.

bool isSelected ( QModelIndex index )

返回 true 若给定模型项 index 被选中。

void reset ()

Clears the selection model. Does not emit any signals.

bool rowIntersectsSelection ( int row , QModelIndex parent )

返回 true 若有选中任何项在 row 采用给定 parent .

void select ( QItemSelection selection , SelectionFlags 命令 )

选择项 selection 使用指定 命令 ,和发射 selectionChanged() .

Valid 命令 values are described in select( index , 命令 ) .

void select ( QModelIndex index , SelectionFlags 命令 )

选择模型项 index 使用指定 命令 ,和发射 selectionChanged() .

Valid values for the 命令 parameter, are:

常量 描述
NoUpdate 不会做出选择。
Clear 完整选定将被清零。
选择 所有指定索引将被选中。
Deselect 所有指定索引将被取消选择。
Toggle 所有指定索引将根据它们的当前状态被选中或取消选择。
Current 当前选定将被更新。
Rows 将扩展所有索引以跨行。
Columns 将扩展所有索引以跨列。
SelectCurrent Select 和 Current 的组合,为方便起见提供。
ToggleCurrent Toggle 和 Current 的组合,为方便起见提供。
ClearAndSelect Clear 和 Select 的组合,为方便起见提供。
QModelIndexList selectedColumns ( int row )

返回的索引在给定 row 对于选中所有行的列而言。

另请参阅 selectedRows() .

QModelIndexList selectedRows ( int column )

返回的索引在给定 column 对于选中所有列的行而言。

另请参阅 selectedColumns() .

void setCurrentIndex ( QModelIndex index , SelectionFlags 命令 )

Sets the model item index to be the current item, and emits currentChanged() . The current item is used for keyboard navigation and focus indication; it is independent of any selected items, although a selected item can also be the current item.

从属指定 命令 index 也可以变为当前选定的一部分。

Valid 命令 values are described in select( index , 命令 ) .

另请参阅 select() .