Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qabstractitemmodel.h>
Public Member Functions | |
constexpr | QModelIndex () noexcept |
Creates a new empty model index. | |
constexpr int | row () const noexcept |
Returns the row this model index refers to. | |
constexpr int | column () const noexcept |
Returns the column this model index refers to. | |
constexpr quintptr | internalId () const noexcept |
Returns a {quintptr} used by the model to associate the index with the internal data structure. | |
void * | internalPointer () const noexcept |
Returns a {void} {*} pointer used by the model to associate the index with the internal data structure. | |
const void * | constInternalPointer () const noexcept |
Returns a {const void} {*} pointer used by the model to associate the index with the internal data structure. | |
QModelIndex | parent () const |
Returns the parent of the model index, or QModelIndex() if it has no parent. | |
QModelIndex | sibling (int row, int column) const |
Returns the sibling at row and column. | |
QModelIndex | siblingAtColumn (int column) const |
Returns the sibling at column for the current row. | |
QModelIndex | siblingAtRow (int row) const |
Returns the sibling at row for the current column. | |
QVariant | data (int role=Qt::DisplayRole) const |
Returns the data for the given role for the item referred to by the index, or a default-constructed QVariant if this model index is \l{isValid()}{invalid}. | |
void | multiData (QModelRoleDataSpan roleDataSpan) const |
Qt::ItemFlags | flags () const |
constexpr const QAbstractItemModel * | model () const noexcept |
Returns a pointer to the model containing the item that this index refers to. | |
constexpr bool | isValid () const noexcept |
Returns {true} if this model index is valid; otherwise returns {false}. | |
Friends | |
class | QAbstractItemModel |
constexpr bool | comparesEqual (const QModelIndex &lhs, const QModelIndex &rhs) noexcept |
constexpr Qt::strong_ordering | compareThreeWay (const QModelIndex &lhs, const QModelIndex &rhs) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
QModelIndexList | |
Synonym for QList<QModelIndex>. | |
\inmodule QtCore
The QModelIndex class is used to locate data in a data model.
\compares strong
This class is used as an index into item models derived from QAbstractItemModel. The index is used by item views, delegates, and selection models to locate an item in the model.
New QModelIndex objects are created by the model using the QAbstractItemModel::createIndex() function. An invalid model index can be constructed with the QModelIndex constructor. Invalid indexes are often used as parent indexes when referring to top-level items in a model.
Model indexes refer to items in models, and contain all the information required to specify their locations in those models. Each index is located in a given row and column, and may have a parent index; use row(), column(), and parent() to obtain this information. Each top-level item in a model is represented by a model index that does not have a parent index - in this case, parent() will return an invalid model index, equivalent to an index constructed with the zero argument form of the QModelIndex() constructor.
To obtain a model index that refers to an existing item in a model, call QAbstractItemModel::index() with the required row and column values, and the model index of the parent. When referring to top-level items in a model, supply QModelIndex() as the parent index.
The model() function returns the model that the index references as a QAbstractItemModel. The child() function is used to examine items held under the index in the model. The sibling() function allows you to traverse items in the model on the same level as the index.
Definition at line 124 of file qabstractitemmodel.h.
|
inlineconstexprnoexcept |
Creates a new empty model index.
This type of model index is used to indicate that the position in the model is invalid.
Definition at line 128 of file qabstractitemmodel.h.
Referenced by QtPrivate::QCalendarModel::setHorizontalHeaderFormat(), and QtPrivate::QCalendarModel::setWeekNumbersShown().
|
inlineconstexprnoexcept |
Returns the column this model index refers to.
Definition at line 131 of file qabstractitemmodel.h.
Referenced by testing.tools.encode_pdf_filter._Ascii85DecodePdfStream::close().
|
inlinenoexcept |
Returns a {const void}
{*} pointer used by the model to associate the index with the internal data structure.
Definition at line 134 of file qabstractitemmodel.h.
|
inline |
Returns the data for the given role for the item referred to by the index, or a default-constructed QVariant if this model index is \l{isValid()}{invalid}.
Definition at line 517 of file qabstractitemmodel.h.
|
inline |
Returns the flags for the item referred to by the index.
Definition at line 523 of file qabstractitemmodel.h.
|
inlineconstexprnoexcept |
Returns a {quintptr} used by the model to associate the index with the internal data structure.
Definition at line 132 of file qabstractitemmodel.h.
|
inlinenoexcept |
Returns a {void}
{*} pointer used by the model to associate the index with the internal data structure.
Definition at line 133 of file qabstractitemmodel.h.
Referenced by operator<<().
|
inlineconstexprnoexcept |
Returns {true} if this model index is valid; otherwise returns
{false}.
A valid index belongs to a model, and has non-negative row and column numbers.
Definition at line 143 of file qabstractitemmodel.h.
|
inlineconstexprnoexcept |
Returns a pointer to the model containing the item that this index refers to.
A const pointer to the model is returned because calls to non-const functions of the model might invalidate the model index and possibly crash your application.
Definition at line 142 of file qabstractitemmodel.h.
|
inline |
Populates the given roleDataSpan for the item referred to by the index.
Definition at line 520 of file qabstractitemmodel.h.
|
inline |
Returns the parent of the model index, or QModelIndex() if it has no parent.
Definition at line 505 of file qabstractitemmodel.h.
|
inlineconstexprnoexcept |
Returns the row this model index refers to.
Definition at line 130 of file qabstractitemmodel.h.
|
inline |
Returns the sibling at row and column.
If there is no sibling at this position, an invalid QModelIndex is returned.
Definition at line 508 of file qabstractitemmodel.h.
|
inline |
Returns the sibling at column for the current row.
If there is no sibling at this position, an invalid QModelIndex is returned.
Definition at line 511 of file qabstractitemmodel.h.
|
inline |
Returns the sibling at row for the current column.
If there is no sibling at this position, an invalid QModelIndex is returned.
Definition at line 514 of file qabstractitemmodel.h.
|
friend |
Definition at line 146 of file qabstractitemmodel.h.
|
friend |
Definition at line 150 of file qabstractitemmodel.h.
|
friend |
Definition at line 126 of file qabstractitemmodel.h.
|
related |
Synonym for QList<QModelIndex>.
Definition at line 250 of file qabstractitemmodel.h.