ItemSelectionModel QML 類型

實例化 QItemSelectionModel 以用於結閤 QAbstractItemModel 及支持它的任何視圖。 更多...

import 語句: import QtQml.Models 2.15
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 : object

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 command )

選擇項 selection 使用指定 command ,和發射 selectionChanged() .

Valid command values are described in select( index , command ) .

void select ( QModelIndex index , SelectionFlags command )

選擇模型項 index 使用指定 command ,和發射 selectionChanged() .

Valid values for the command 參數,是:

常量 描述
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 command )

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.

從屬指定 command index 也可以變為當前選定的一部分。

Valid command values are described in select( index , command ) .

另請參閱 select() .