IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QItemSelectionModel Class

The https:// class keeps track of a view's selected items.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QItemSelectionModel Class▲

  • Header: QItemSelectionModel

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

  • Inherits: https://

  • Group: QItemSelectionModel is part of model-view

Detailed Description▲

A https:// 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.

The https:// class is one of the Model/View Classes and is part of Qt's model/view framework.

The selected items are stored using ranges. Whenever you want to modify the selected items use https://() and provide either a https://, or a https:// and a https://.

The https:// 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).

To update the currently selected items, use the bitwise OR of https:// and any of the other https://. If you omit the https:// 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.

Since 5.5, https://, https://, and https:// are meta-object properties.

See Also▲

See also https://, QAbstractItemModel, Chart Example

Member Type Documentation▲

 

enum QItemSelectionModel::SelectionFlag▲

flags QItemSelectionModel::SelectionFlags

This enum describes the way the selection model will be updated.

Constant

Value

Description

https://::NoUpdate

0x0000

No selection will be made.

https://::Clear

0x0001

The complete selection will be cleared.

https://::Select

0x0002

All specified indexes will be selected.

https://::Deselect

0x0004

All specified indexes will be deselected.

https://::Toggle

0x0008

All specified indexes will be selected or deselected depending on their current state.

https://::Current

0x0010

The current selection will be updated.

https://::Rows

0x0020

All indexes will be expanded to span rows.

https://::Columns

0x0040

All indexes will be expanded to span columns.

https://::SelectCurrent

Select | Current

A combination of Select and Current, provided for convenience.

https://::ToggleCurrent

Toggle | Current

A combination of Toggle and Current, provided for convenience.

https://::ClearAndSelect

Clear | Select

A combination of Clear and Select, provided for convenience.

The SelectionFlags type is a typedef for https://<SelectionFlag>. It stores an OR combination of SelectionFlag values.

Property Documentation▲

 

[read-only, since 5.5] selectedIndexes : const QModelIndexList▲

This property was introduced in Qt 5.5.

Access functions:

  • https://() const

Notifier signal:

  • void https://(const &selected, const &deselected)

Member Function Documentation▲

 

[explicit] QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model = nullptr)▲

Constructs a selection model that operates on the specified item model.

[explicit] QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)▲

Constructs a selection model that operates on the specified item model with parent.

[virtual] QItemSelectionModel::~QItemSelectionModel()▲

Destroys the selection model.

[virtual] void QItemSelectionModel::clear()▲

Clears the selection model. Emits https://() and https://().

[virtual] void QItemSelectionModel::clearCurrentIndex()▲

Clears the current index. Emits https://().

void QItemSelectionModel::clearSelection()▲

Clears the selection in the selection model. Emits https://().

bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelIndex &parent = QModelIndex()) const▲

Returns true if there are any items selected in the column with the given parent.

Since Qt 5.15, the default argument for parent is an empty model index.

void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)▲

This signal is emitted whenever the current item changes. The 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.

See Also▲

See also https://(), https://(), https://()

void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)▲

This signal is emitted if the current item changes and its column is different to the column of the previous current item.

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

See Also▲

See also https://(), https://(), https://(), https://()

QModelIndex QItemSelectionModel::currentIndex() const▲

Returns the model item index for the current item, or an invalid index if there is no current item.

See Also▲

See also https://()

void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)▲

This signal is emitted if the current item changes and its row is different to the row of the previous current item.

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

See Also▲

See also https://(), https://(), https://(), https://()

[protected] void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection)▲

Compares the two selections newSelection and oldSelection and emits https://() with the deselected and selected items.

bool QItemSelectionModel::hasSelection() const▲

Returns true if the selection model contains any selected item, otherwise returns false.

bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent = QModelIndex()) const▲

Returns true if all items are selected in the column with the given parent.

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

Since Qt 5.15, the default argument for parent is an empty model index.

bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent = QModelIndex()) const▲

Returns true if all items are selected in the row with the given parent.

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

Since Qt 5.15, the default argument for parent is an empty model index.

bool QItemSelectionModel::isSelected(const QModelIndex &index) const▲

Returns true if the given model item index is selected.

const QAbstractItemModel *QItemSelectionModel::model() const▲

Returns the item model operated on by the selection model.

See Also▲

See also https://()

[since 5.5] QAbstractItemModel *QItemSelectionModel::model()▲

Returns the item model operated on by the selection model.

This function was introduced in Qt 5.5.

[since 5.5] void QItemSelectionModel::modelChanged(QAbstractItemModel *model)▲

This signal is emitted when the model is successfully set with https://().

This function was introduced in Qt 5.5.

See Also▲

See also https://(), https://()

[virtual] void QItemSelectionModel::reset()▲

Clears the selection model. Does not emit any signals.

bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &parent = QModelIndex()) const▲

Returns true if there are any items selected in the row with the given parent.

Since Qt 5.15, the default argument for parent is an empty model index.

[virtual] void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)▲

Selects the model item index using the specified command, and emits https://().

See Also▲

See also https://

[virtual] void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)▲

Selects the item selection using the specified command, and emits https://().

See Also▲

See also https://

QModelIndexList QItemSelectionModel::selectedColumns(int row = 0) const▲

Returns the indexes in the given row for columns where all rows are selected.

See Also▲

See also https://(), https://()

QModelIndexList QItemSelectionModel::selectedIndexes() const▲

Returns a list of all selected model item indexes. The list contains no duplicates, and is not sorted.

Getter function for property https://.

QModelIndexList QItemSelectionModel::selectedRows(int column = 0) const▲

Returns the indexes in the given column for the rows where all columns are selected.

See Also▲

See also https://(), https://()

const QItemSelection QItemSelectionModel::selection() const▲

Returns the selection ranges stored in the selection model.

void QItemSelectionModel::selectionChanged(const QItemSelection &selected, const 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 items.

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.

Items which stay selected but change their index are not included in selected and deselected. Thus, this signal might be emitted with both selected and deselected empty, if only the indices of selected items change.

Notifier signal for property https://.

See Also▲

See also https://(), https://()

[virtual] void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)▲

Sets the model item index to be the current item, and emits https://(). 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.

Depending on the specified command, the index can also become part of the current selection.

See Also▲

See also https://(), https://()

[since 5.5] void QItemSelectionModel::setModel(QAbstractItemModel *model)▲

Sets the model to model. The https://() signal will be emitted.

This function was introduced in Qt 5.5.

See Also▲

See also https://(), https://()

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.