QItemSelectionModel Class | Qt Core 5.15.18 (original) (raw)
Member Function Documentation
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)
Constructs a selection model that operates on the specified item model with parent.
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model = nullptr)
Constructs a selection model that operates on the specified item model.
[virtual slot]
void QItemSelectionModel::clear()
Clears the selection model. Emits selectionChanged() and currentChanged().
[virtual slot]
void QItemSelectionModel::clearCurrentIndex()
Clears the current index. Emits currentChanged().
[slot]
void QItemSelectionModel::clearSelection()
Clears the selection in the selection model. Emits selectionChanged().
This function was introduced in Qt 4.2.
[signal]
void QItemSelectionModel::currentChanged(const QModelIndex ¤t, 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 currentIndex(), setCurrentIndex(), and selectionChanged().
[signal]
void QItemSelectionModel::currentColumnChanged(const QModelIndex ¤t, 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 currentChanged(), currentRowChanged(), currentIndex(), and setCurrentIndex().
[signal]
void QItemSelectionModel::currentRowChanged(const QModelIndex ¤t, 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 currentChanged(), currentColumnChanged(), currentIndex(), and setCurrentIndex().
[signal]
void QItemSelectionModel::modelChanged(QAbstractItemModel *model)
This signal is emitted when the model is successfully set with setModel().
This function was introduced in Qt 5.5.
See also model() and setModel().
[virtual slot]
void QItemSelectionModel::reset()
Clears the selection model. Does not emit any signals.
[virtual slot]
void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
Selects the item selection using the specified command, and emits selectionChanged().
See also QItemSelectionModel::SelectionFlag.
[virtual slot]
void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
See also QItemSelectionModel::SelectionFlags.
[signal]
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.
Note: Notifier signal for property selectedIndexes.
See also select() and currentChanged().
[virtual slot]
void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::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.
Depending on the specified command, the index can also become part of the current selection.
See also currentIndex() and select().
[virtual]
QItemSelectionModel::~QItemSelectionModel()
Destroys the selection model.
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.
Note: Since Qt 5.15, the default argument for parent is an empty model index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
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 setCurrentIndex().
[protected]
void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection)
Compares the two selections newSelection and oldSelection and emits selectionChanged() with the deselected and selected items.
bool QItemSelectionModel::hasSelection() const
Returns true
if the selection model contains any selection ranges; otherwise returns false
.
This function was introduced in Qt 4.2.
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 isSelected() on all items in the same column and that unselectable items are ignored.
Note: Since Qt 5.15, the default argument for parent is an empty model index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
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 isSelected() on all items in the same row and that unselectable items are ignored.
Note: Since Qt 5.15, the default argument for parent is an empty model index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
bool QItemSelectionModel::isSelected(const QModelIndex &index) const
Returns true
if the given model item index is selected.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
const QAbstractItemModel *QItemSelectionModel::model() const
Returns the item model operated on by the selection model.
See also setModel().
QAbstractItemModel *QItemSelectionModel::model()
Returns the item model operated on by the selection model.
This function was introduced in Qt 5.5.
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.
Note: Since Qt 5.15, the default argument for parent is an empty model index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QModelIndexList QItemSelectionModel::selectedColumns(int row = 0) const
Returns the indexes in the given row for columns where all rows are selected.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
This function was introduced in Qt 4.2.
See also selectedIndexes() and selectedRows().
QModelIndexList QItemSelectionModel::selectedIndexes() const
Returns a list of all selected model item indexes. The list contains no duplicates, and is not sorted.
Note: Getter function for property selectedIndexes.
QModelIndexList QItemSelectionModel::selectedRows(int column = 0) const
Returns the indexes in the given column for the rows where all columns are selected.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
This function was introduced in Qt 4.2.
See also selectedIndexes() and selectedColumns().
const QItemSelection QItemSelectionModel::selection() const
Returns the selection ranges stored in the selection model.
void QItemSelectionModel::setModel(QAbstractItemModel *model)
Sets the model to model. The modelChanged() signal will be emitted.
This function was introduced in Qt 5.5.
See also model() and modelChanged().