Qt 4.8
Public Functions | Private Functions | Properties | Friends | Related Functions | List of all members
QModelIndex Class Reference

The QModelIndex class is used to locate data in a data model. More...

#include <qabstractitemmodel.h>

Public Functions

QModelIndex child (int row, int column) const
 Returns the child of the model index that is stored in the given row and column. More...
 
int column () const
 Returns the column this model index refers to. More...
 
QVariant data (int role=Qt::DisplayRole) const
 Returns the data for the given role for the item referred to by the index. More...
 
Qt::ItemFlags flags () const
 Returns the flags for the item referred to by the index. More...
 
qint64 internalId () const
 Returns a qint64 used by the model to associate the index with the internal data structure. More...
 
void * internalPointer () const
 Returns a void * pointer used by the model to associate the index with the internal data structure. More...
 
bool isValid () const
 Returns true if this model index is valid; otherwise returns false. More...
 
const QAbstractItemModelmodel () const
 Returns a pointer to the model containing the item that this index refers to. More...
 
bool operator!= (const QModelIndex &other) const
 Returns true if this model index does not refer to the same location as the other model index; otherwise returns false. More...
 
bool operator< (const QModelIndex &other) const
 Returns true if this model index is smaller than the other model index; otherwise returns false. More...
 
bool operator== (const QModelIndex &other) const
 Returns true if this model index refers to the same location as the other model index; otherwise returns false. More...
 
QModelIndex parent () const
 Returns the parent of the model index, or QModelIndex() if it has no parent. More...
 
 QModelIndex ()
 Creates a new empty model index. More...
 
 QModelIndex (const QModelIndex &other)
 Creates a new model index that is a copy of the other model index. More...
 
int row () const
 Returns the row this model index refers to. More...
 
QModelIndex sibling (int row, int column) const
 Returns the sibling at row and column. More...
 
 ~QModelIndex ()
 Destroys the model index. More...
 

Private Functions

 QModelIndex (int row, int column, void *ptr, const QAbstractItemModel *model)
 

Properties

int c
 
const QAbstractItemModelm
 
void * p
 
int r
 

Friends

class QAbstractItemModel
 
class QProxyModel
 

Related Functions

(Note that these are not member functions.)

 QModelIndexList
 Synonym for QList<QModelIndex>. More...
 

Detailed Description

The QModelIndex class is used to locate data in a data model.

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.

Note
Model indexes should be used immediately and then discarded. You should not rely on indexes to remain valid after calling model functions that change the structure of the model or delete items. If you need to keep a model index over time use a QPersistentModelIndex.
See also
{Model/View Programming}, QPersistentModelIndex, QAbstractItemModel

Definition at line 58 of file qabstractitemmodel.h.

Constructors and Destructors

◆ QModelIndex() [1/3]

QModelIndex::QModelIndex ( )
inline

Creates a new empty model index.

This type of model index is used to indicate that the position in the model is invalid.

See also
isValid() QAbstractItemModel

Definition at line 63 of file qabstractitemmodel.h.

Referenced by child(), parent(), and sibling().

63 : r(-1), c(-1), p(0), m(0) {}
const QAbstractItemModel * m

◆ QModelIndex() [2/3]

QModelIndex::QModelIndex ( const QModelIndex other)
inline

Creates a new model index that is a copy of the other model index.

Definition at line 64 of file qabstractitemmodel.h.

65  : r(other.r), c(other.c), p(other.p), m(other.m) {}
const QAbstractItemModel * m

◆ ~QModelIndex()

QModelIndex::~QModelIndex ( )
inline

Destroys the model index.

Definition at line 66 of file qabstractitemmodel.h.

66 { p = 0; m = 0; }
const QAbstractItemModel * m

◆ QModelIndex() [3/3]

QModelIndex::QModelIndex ( int  row,
int  column,
void *  data,
const QAbstractItemModel model 
)
inlineprivate
Warning
This function is not part of the public interface.

Creates a new model index at the given row and column, pointing to some data.

Definition at line 388 of file qabstractitemmodel.h.

390  : r(arow), c(acolumn), p(adata), m(amodel) {}
const QAbstractItemModel * m

Functions

◆ child()

QModelIndex QModelIndex::child ( int  row,
int  column 
) const
inline

Returns the child of the model index that is stored in the given row and column.

Note
This function does not work for an invalid model index which is often used as the root index.
See also
parent(), sibling()

Definition at line 398 of file qabstractitemmodel.h.

Referenced by QPersistentModelIndex::child(), and ModelIndexIterator::ModelIndexIterator().

399 { return m ? m->index(arow, acolumn, *this) : QModelIndex(); }
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
QModelIndex()
Creates a new empty model index.
const QAbstractItemModel * m

◆ column()

int QModelIndex::column ( ) const
inline

Returns the column this model index refers to.

Definition at line 68 of file qabstractitemmodel.h.

Referenced by QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(), QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(), QListWidgetPrivate::_q_dataChanged(), QTableWidgetPrivate::_q_dataChanged(), QTreeWidgetPrivate::_q_dataChanged(), QTableWidgetPrivate::_q_emitCurrentItemChanged(), QTableWidgetPrivate::_q_emitItemActivated(), QTreeWidgetPrivate::_q_emitItemActivated(), QStandardItemModelPrivate::_q_emitItemChanged(), QTableWidgetPrivate::_q_emitItemChanged(), QTreeWidgetPrivate::_q_emitItemChanged(), QTableWidgetPrivate::_q_emitItemClicked(), QTreeWidgetPrivate::_q_emitItemClicked(), QTableWidgetPrivate::_q_emitItemDoubleClicked(), QTreeWidgetPrivate::_q_emitItemDoubleClicked(), QTableWidgetPrivate::_q_emitItemEntered(), QTreeWidgetPrivate::_q_emitItemEntered(), QTableWidgetPrivate::_q_emitItemPressed(), QTreeWidgetPrivate::_q_emitItemPressed(), QHeaderViewPrivate::_q_layoutChanged(), QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(), QSortFilterProxyModelPrivate::_q_sourceDataChanged(), QTableViewPrivate::accessibleTable2Index(), QTreeViewPrivate::accessibleTable2Index(), QTreeViewPrivate::adjustViewOptionsForIndex(), QAbstractItemModelPrivate::allowMove(), QSortFilterProxyModelPrivate::can_create_mapping(), QAccessibleTree::childAt(), QPersistentModelIndex::column(), QDirModel::columnCount(), QFileSystemModel::columnCount(), QAccessibleTable2Cell::columnHeaderCells(), QAccessibleTable2Cell::columnIndex(), QTreeViewPrivate::columnRanges(), QAbstractItemModelPrivate::columnsAboutToBeInserted(), QAbstractItemModelPrivate::columnsAboutToBeRemoved(), QAbstractItemModelPrivate::columnsInserted(), QAbstractItemModelPrivate::columnsRemoved(), QItemSelectionRange::contains(), QScriptDebuggerLocalsItemDelegate::createEditor(), QScriptBreakpointsItemDelegate::createEditor(), QPPDOptionsEditor::createEditor(), QHeaderView::currentChanged(), QTreeView::currentChanged(), QTableWidget::currentColumn(), QTreeWidget::currentColumn(), QUndoModel::data(), QSqlQueryModel::data(), QScriptDebuggerStackModel::data(), QSqlTableModel::data(), QScriptDebuggerLocalsModel::data(), QDirModel::data(), QSqlRelationalTableModel::data(), QScriptBreakpointsModel::data(), QFileSystemModel::data(), QTreeModel::data(), QPPDOptionsModel::data(), QCalendarModel::data(), QUrlModel::dataChanged(), QTreeView::dataChanged(), QHeaderView::dataChanged(), QIconModeViewBase::dataChanged(), QAbstractItemViewPrivate::delegateForIndex(), QTreeViewPrivate::draggablePaintPairs(), QTableWidget::dropEvent(), QSortFilterProxyModel::dropMimeData(), QTableModel::dropMimeData(), QAbstractTableModel::dropMimeData(), QAbstractItemViewPrivate::dropOn(), QListModeViewBase::dropOn(), QAbstractItemModel::endMoveColumns(), QAbstractItemModel::endMoveRows(), QListModel::ensureSorted(), QTreeModel::ensureSorted(), QSortFilterProxyModelPrivate::filter_changed(), QSqlTableModel::flags(), QScriptDebuggerLocalsModel::flags(), QDirModel::flags(), QScriptBreakpointsModel::flags(), QFileSystemModel::flags(), QPPDOptionsModel::flags(), QCalendarModel::flags(), QCalendarWidgetPrivate::getCurrentDate(), QCalendarView::handleMouseEvent(), QFileSystemModel::hasChildren(), QDirModel::hasChildren(), QSqlQueryModel::headerData(), QAbstractProxyModel::headerData(), QDirModel::index(), QFileSystemModel::index(), QTreeView::indexAt(), QSqlQueryModel::indexInQuery(), QSqlTableModel::indexInQuery(), QAccessibleTree::indexOfChild(), QAbstractItemModelPrivate::indexValid(), QTreeModel::insertColumns(), QTreeModel::insertRows(), QSqlTableModel::isDirty(), QTableView::isIndexHidden(), QListView::isIndexHidden(), QTreeView::isIndexHidden(), QAbstractItemViewPrivate::isIndexValid(), QTableModel::isValid(), QTableModel::item(), QTreeModel::itemData(), QStandardItemModelPrivate::itemFromIndex(), QStandardItemModel::itemFromIndex(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QTreeView::keyboardSearch(), QAbstractItemView::keyboardSearch(), QAccessibleTable2::logicalIndex(), QIdentityProxyModel::mapFromSource(), QCompletionModel::mapFromSource(), QIdentityProxyModel::mapToSource(), QCompletionModel::mapToSource(), QAbstractItemModel::match(), mergeIndexes(), QUrlModel::mimeData(), QTreeModel::mimeData(), QColumnView::moveCursor(), QTableView::moveCursor(), QTreeView::moveCursor(), QCalendarView::moveCursor(), QAbstractItemModelPrivate::movePersistentIndexes(), QItemSelectionRange::operator<(), operator<<(), QCalendarDelegate::paint(), QCompleter::pathFromIndex(), QSqlQueryModelPrivate::prefetch(), QSortFilterProxyModelPrivate::proxy_to_source(), qContainsIndex(), qHash(), QListViewPrivate::rectForIndex(), QAccessibleTable2Cell::rowColumnExtents(), QDirModel::rowCount(), QFileSystemModel::rowCount(), QAbstractItemView::rowsAboutToBeRemoved(), QAbstractItemModelPrivate::rowsInserted(), QTreeView::rowsInserted(), QAbstractItemModelPrivate::rowsRemoved(), QDirModelPrivate::savePersistentIndexes(), QTableView::scrollTo(), QListView::scrollTo(), QTreeView::scrollTo(), QItemSelection::select(), QTableViewPrivate::selectColumn(), QAccessibleTable2::selectedColumns(), QListView::selectedIndexes(), QTreeView::selectionChanged(), QComboBoxPrivate::setCurrentIndex(), QDataWidgetMapper::setCurrentModelIndex(), QSqlTableModel::setData(), QDirModel::setData(), QSqlRelationalTableModel::setData(), QScriptBreakpointsModel::setData(), QFileSystemModel::setData(), QTreeModel::setData(), QTableModel::setData(), QPPDOptionsEditor::setEditorData(), QAbstractProxyModel::setHeaderData(), QTableModel::setItemData(), QScriptDebuggerLocalsItemDelegate::setModelData(), QScriptBreakpointsItemDelegate::setModelData(), QListView::setPositionForIndex(), QTableView::setSelection(), QUndoModel::setStackCurrentIndex(), QFileDialogComboBox::showPopup(), QTableView::sizeHintForRow(), QFileSystemModel::sort(), QSortFilterProxyModelPrivate::source_to_proxy(), QSortFilterProxyModelPrivate::update_source_sort_column(), QSortFilterProxyModelPrivate::updateChildrenMapping(), QAbstractItemViewPrivate::updateEditorData(), QTableView::visualRect(), QTreeView::visualRect(), QTreeView::visualRegionForSelection(), and QCalendarView::wheelEvent().

68 { return c; }

◆ data()

QVariant QModelIndex::data ( int  role = Qt::DisplayRole) const
inline

Returns the data for the given role for the item referred to by the index.

Definition at line 401 of file qabstractitemmodel.h.

Referenced by QFileDialogPrivate::_q_currentChanged(), QFileDialogPrivate::_q_deleteCurrent(), QFileDialogPrivate::_q_enterDirectory(), QFileDialogPrivate::_q_goToDirectory(), QFileDialogPrivate::_q_selectionChanged(), QUrlModel::addUrls(), QUrlModel::changed(), QStyledItemDelegate::createEditor(), QItemDelegate::createEditor(), QPersistentModelIndex::data(), QItemDelegate::drawBackground(), QStyledItemDelegate::editorEvent(), QItemDelegate::editorEvent(), QFileSystemModel::fileIcon(), QCompletionEngine::filterHistory(), QUrlModel::flags(), QComboMenuDelegate::getStyleOption(), QAbstractItemDelegate::helpEvent(), QSideBarDelegate::initStyleOption(), QStyledItemDelegate::initStyleOption(), QComboBoxDelegate::isSeparator(), QUrlModel::mimeData(), QItemDelegate::paint(), QFontFamilyDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QFSCompleter::pathFromIndex(), QFileDialogPrivate::qt_mac_filedialog_event_proc(), QItemDelegate::rect(), QFileDialog::selectedFiles(), QFileDialog::selectFile(), QSidebar::selectUrl(), QFileSystemModel::setData(), QStyledItemDelegate::setEditorData(), QItemDelegate::setEditorData(), QFileDialogComboBox::setHistory(), QItemDelegate::setOptions(), QUrlModel::setUrl(), QFileDialogComboBox::showPopup(), QStyledItemDelegate::sizeHint(), QItemDelegate::sizeHint(), QFontFamilyDelegate::sizeHint(), and QItemDelegate::updateEditorGeometry().

402 { return m ? m->data(*this, arole) : QVariant(); }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
const QAbstractItemModel * m
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.

◆ flags()

Qt::ItemFlags QModelIndex::flags ( ) const
inline

Returns the flags for the item referred to by the index.

Since
4.2

Definition at line 404 of file qabstractitemmodel.h.

Referenced by QCompleterPrivate::_q_complete(), QAbstractItemView::closeEditor(), QItemSelection::contains(), QComboBoxPrivateContainer::eventFilter(), QIconModeViewBase::filterDropEvent(), QPersistentModelIndex::flags(), QAccessibleTable2Cell::setText(), QAccessibleItemRow::state(), and QAccessibleTable2Cell::state().

405 { return m ? m->flags(*this) : Qt::ItemFlags(0); }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
const QAbstractItemModel * m

◆ internalId()

void * QModelIndex::internalId ( ) const
inline

◆ internalPointer()

void * QModelIndex::internalPointer ( ) const
inline

◆ isValid()

bool QModelIndex::isValid ( ) const
inline

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.

See also
model(), row(), column()

Definition at line 77 of file qabstractitemmodel.h.

Referenced by QColumnViewPrivate::_q_changeCurrentColumn(), QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(), QCompleterPrivate::_q_complete(), QFileDialogPrivate::_q_createDirectory(), QListWidgetPrivate::_q_dataChanged(), QTableWidgetPrivate::_q_dataChanged(), QTreeWidgetPrivate::_q_dataChanged(), QScriptBreakpointsWidgetPrivate::_q_deleteBreakpoint(), QFileDialogPrivate::_q_deleteCurrent(), QComboBoxPrivate::_q_emitHighlighted(), QFileDialogPrivate::_q_goToDirectory(), QHeaderViewPrivate::_q_layoutChanged(), QScriptDebuggerScriptsWidgetPrivate::_q_onCurrentChanged(), QScriptBreakpointsWidgetPrivate::_q_onCurrentChanged(), QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeRemoved(), QIdentityProxyModelPrivate::_q_sourceColumnsInserted(), QSortFilterProxyModelPrivate::_q_sourceColumnsInserted(), QIdentityProxyModelPrivate::_q_sourceColumnsMoved(), QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(), QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved(), QIdentityProxyModelPrivate::_q_sourceDataChanged(), QSortFilterProxyModelPrivate::_q_sourceDataChanged(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeInserted(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeMoved(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeRemoved(), QIdentityProxyModelPrivate::_q_sourceRowsInserted(), QIdentityProxyModelPrivate::_q_sourceRowsMoved(), QIdentityProxyModelPrivate::_q_sourceRowsRemoved(), QFileDialogPrivate::_q_updateOkButton(), QIconModeViewBase::addLeaf(), QAbstractItemModelPrivate::allowMove(), QAbstractItemModel::beginMoveColumns(), QAbstractItemModel::beginMoveRows(), QSortFilterProxyModelPrivate::can_create_mapping(), QScriptDebuggerLocalsModel::canFetchMore(), QSqlQueryModel::canFetchMore(), QAccessibleTable2::cell(), QAccessibleTable2::cellAt(), QAccessibleTree::cellAt(), QAbstractItemModel::changePersistentIndex(), QAbstractItemModel::changePersistentIndexList(), QAccessibleTable2::childAt(), QAccessibleTree::childAt(), QAccessibleItemView::childCount(), QAccessibleTable2::childFromLogical(), QItemSelectionModel::clear(), QColumnViewPrivate::closeColumns(), QAbstractItemView::closeEditor(), QIdentityProxyModel::columnCount(), QSqlQueryModel::columnCount(), QScriptDebuggerStackModel::columnCount(), QScriptBreakpointsModel::columnCount(), QTableModel::columnCount(), QSortFilterProxyModel::columnCount(), QAbstractListModel::columnCount(), QItemSelectionModel::columnIntersectsSelection(), QAbstractItemModelPrivate::columnsAboutToBeInserted(), QAbstractItemModelPrivate::columnsAboutToBeRemoved(), QAbstractItemModelPrivate::columnsInserted(), QAbstractItemModelPrivate::columnsRemoved(), QAbstractItemView::commitData(), QCompleter::complete(), QDeclarativeFolderListModel::componentComplete(), QPersistentModelIndexData::create(), QSortFilterProxyModelPrivate::create_mapping(), QStyledItemDelegate::createEditor(), QItemDelegate::createEditor(), QFontListView::currentChanged(), QColumnView::currentChanged(), QTableView::currentChanged(), QListView::currentChanged(), QHeaderView::currentChanged(), QTreeView::currentChanged(), QAbstractItemView::currentChanged(), QSqlQueryModel::data(), QScriptDebuggerStackModel::data(), QSqlTableModel::data(), QScriptDebuggerLocalsModel::data(), QDeclarativeFolderListModel::data(), QScriptDebuggerScriptsModel::data(), QScriptBreakpointsModel::data(), QFileSystemModel::data(), QListModel::data(), QTreeModel::data(), ControlList::data(), QSortFilterProxyModel::data(), QPPDOptionsModel::data(), QAbstractItemView::dataChanged(), QAccessibleItemRow::doAction(), QListModeViewBase::dragMoveEvent(), QAbstractItemView::dragMoveEvent(), QTableViewPrivate::drawAndClipSpans(), QTreeView::drawRow(), QTreeWidget::dropEvent(), QIdentityProxyModel::dropMimeData(), QDirModel::dropMimeData(), QFileSystemModel::dropMimeData(), QListModel::dropMimeData(), QTableModel::dropMimeData(), QAbstractTableModel::dropMimeData(), QAbstractListModel::dropMimeData(), QAbstractItemViewPrivate::dropOn(), QListModeViewBase::dropOn(), QAbstractItemViewPrivate::droppingOnItself(), QComboBoxPrivate::emitActivated(), QAbstractItemView::event(), QCompleter::eventFilter(), QComboBoxPrivateContainer::eventFilter(), QAbstractItemViewPrivate::extendedSelectionCommand(), QSqlQueryModel::fetchMore(), QFileSystemModelPrivate::filePath(), QSortFilterProxyModel::filterAcceptsRow(), QIconModeViewBase::filterDragMoveEvent(), QStringListModel::flags(), QScriptDebuggerLocalsModel::flags(), QUrlModel::flags(), QScriptBreakpointsModel::flags(), QFileSystemModel::flags(), QListModel::flags(), QTreeModel::flags(), QTableModel::flags(), QPPDOptionsModel::flags(), QAbstractItemView::focusInEvent(), QFileSystemModel::hasChildren(), QDirModel::hasChildren(), QTreeModel::hasChildren(), QSortFilterProxyModel::hasChildren(), QCompletionModel::hasChildren(), QAbstractTableModel::hasChildren(), QAbstractListModel::hasChildren(), QFileSystemModelPrivate::icon(), QUndoModel::index(), QIdentityProxyModel::index(), QScriptDebuggerScriptsModel::index(), QScriptBreakpointsModel::index(), QTreeModel::index(), QDirModel::index(), QPPDOptionsModel::index(), QCompletionModel::index(), QSortFilterProxyModelPrivate::index_to_iterator(), QListView::indexAt(), QTreeView::indexAt(), QAccessibleTree::indexFromLogical(), QAccessibleItemRow::indexOfChild(), QAccessibleItemView::indexOfChild(), QTreeView::indexRowSizeHint(), QIconModeViewBase::indexToListViewItem(), QListViewPrivate::indexToListViewItem(), QAbstractItemView::inputMethodQuery(), QSortFilterProxyModelPrivate::insert_source_items(), QIdentityProxyModel::insertColumns(), QSqlQueryModel::insertColumns(), QSortFilterProxyModel::insertColumns(), QStandardItemModel::insertColumns(), QIdentityProxyModel::insertRows(), QSqlTableModel::insertRows(), QListModel::insertRows(), QSortFilterProxyModel::insertRows(), QStandardItemModel::insertRows(), QListModeViewBase::intersectingSet(), QItemSelectionModel::isColumnSelected(), QFileSystemModel::isDir(), QSqlTableModel::isDirty(), QDeclarativeFolderListModel::isFolder(), QFileSystemModelPrivate::isHiddenByFilter(), QItemSelectionModel::isRowSelected(), QItemSelectionModel::isSelected(), QPersistentModelIndex::isValid(), QTableModel::isValid(), QAccessibleTable2Cell::isValid(), QTreeModel::item(), QTableModel::itemChanged(), QListModel::itemData(), QStandardItemModelPrivate::itemFromIndex(), QTreeViewPrivate::itemHeight(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QComboBoxPrivate::itemText(), QTreeView::keyboardSearch(), QAbstractItemView::keyboardSearch(), QScriptBreakpointsWidget::keyPressEvent(), QAbstractItemView::keyPressEvent(), QFileSystemModel::lastModified(), QTreeViewPrivate::layout(), QUrlModel::layoutChanged(), QAccessibleTable2::logicalIndex(), QIdentityProxyModel::mapFromSource(), QCompletionModel::mapFromSource(), QAbstractProxyModel::mapSelectionFromSource(), QAbstractProxyModel::mapSelectionToSource(), QIdentityProxyModel::mapToSource(), QCompletionModel::mapToSource(), QIdentityProxyModel::match(), QAbstractItemModel::match(), QFileSystemModel::mkdir(), ModelIndexIterator::ModelIndexIterator(), QAbstractItemView::mouseDoubleClickEvent(), QAbstractItemView::mousePressEvent(), QColumnView::moveCursor(), QTableView::moveCursor(), QListView::moveCursor(), QTreeView::moveCursor(), QAbstractItemModelPrivate::movePersistentIndexes(), QFileSystemModelPrivate::name(), QAccessibleItemRow::navigate(), QAccessibleTree::navigate(), QAccessibleItemView::navigate(), QFileSystemModelPrivate::node(), QScriptDebuggerLocalsModelPrivate::nodeFromIndex(), QPersistentModelIndex::operator!=(), QPersistentModelIndex::operator=(), QPersistentModelIndex::operator==(), QStyledItemDelegate::paint(), QItemDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QTableView::paintEvent(), QListView::paintEvent(), QIdentityProxyModel::parent(), QScriptDebuggerLocalsModel::parent(), QScriptDebuggerScriptsModel::parent(), QTreeModel::parent(), QPPDOptionsModel::parent(), QCompleter::pathFromIndex(), QScriptDebuggerLocalsModelPrivate::populateIndex(), QSortFilterProxyModelPrivate::proxy_to_source(), QAccessibleTable2Cell::QAccessibleTable2Cell(), QPersistentModelIndex::QPersistentModelIndex(), QScriptDebuggerLocalsModelPrivate::reallyPopulateIndex(), QScriptDebuggerLocalsModelPrivate::reallySyncIndex(), QSortFilterProxyModelPrivate::remove_source_items(), QSqlQueryModel::removeColumns(), QIdentityProxyModel::removeColumns(), QSqlRelationalTableModel::removeColumns(), QSqlTableModel::removeColumns(), QSortFilterProxyModel::removeColumns(), QAbstractItemModelPrivate::removePersistentIndexData(), QIdentityProxyModel::removeRows(), QSqlTableModel::removeRows(), QListModel::removeRows(), QSortFilterProxyModel::removeRows(), QTreeViewPrivate::removeViewItems(), QDirModelPrivate::restorePersistentIndexes(), QStringListModel::rowCount(), QUndoModel::rowCount(), QSqlQueryModel::rowCount(), QIdentityProxyModel::rowCount(), QScriptDebuggerStackModel::rowCount(), QDirModel::rowCount(), QScriptDebuggerScriptsModel::rowCount(), QFileSystemModel::rowCount(), QScriptBreakpointsModel::rowCount(), QListModel::rowCount(), QTreeModel::rowCount(), QSqlTableModel::rowCount(), QTableModel::rowCount(), QSortFilterProxyModel::rowCount(), QPPDOptionsModel::rowCount(), QCompletionModel::rowCount(), QItemSelectionModel::rowIntersectsSelection(), QAbstractItemModelPrivate::rowsAboutToBeInserted(), QAbstractItemModelPrivate::rowsAboutToBeRemoved(), QAbstractItemView::rowsAboutToBeRemoved(), QAbstractItemModelPrivate::rowsInserted(), QTreeView::rowsInserted(), QAbstractItemModelPrivate::rowsRemoved(), QScriptDebuggerScriptsModel::scriptFunctionInfoFromIndex(), QScriptDebuggerScriptsModel::scriptIdFromIndex(), QColumnView::scrollTo(), QTreeView::scrollTo(), QTableWidget::scrollToItem(), QFileDialogPrivate::select(), QTreeViewPrivate::select(), QItemSelection::select(), QListViewPrivate::selectAll(), QAccessibleTable2::selectColumn(), QTreeView::selectedIndexes(), QFileDialog::selectFile(), QListViewPrivate::selection(), QListViewPrivate::selectionAllowed(), QTableView::selectionChanged(), QListView::selectionChanged(), QTreeView::selectionChanged(), QAccessibleTable2::selectRow(), QAccessibleTree::selectRow(), QCompleterPrivate::setCurrentIndex(), QAbstractItemView::setCurrentIndex(), QComboBoxPrivate::setCurrentIndex(), QDataWidgetMapper::setCurrentModelIndex(), QSqlTableModel::setData(), QScriptDebuggerLocalsModel::setData(), QScriptBreakpointsModel::setData(), QFileSystemModel::setData(), QListModel::setData(), QTreeModel::setData(), QTableModel::setData(), QSortFilterProxyModel::setData(), QStandardItemModel::setData(), QTreeView::setFirstColumnSpanned(), QDeclarativeFolderListModel::setFolder(), QTableModel::setItemData(), QComboBox::setItemData(), QComboBox::setItemIcon(), QComboBox::setItemText(), QProxyModel::setProxyModel(), QFileDialogPrivate::setRootIndex(), QAbstractItemView::setRootIndex(), QTreeView::setRowHidden(), QTableView::setSelection(), QListView::setSelection(), QTreeView::setSelection(), QAccessibleItemRow::setText(), QUrlModel::setUrl(), QAbstractItemViewPrivate::shouldEdit(), QComboBox::showPopup(), QFileDialogComboBox::showPopup(), QFileSystemModel::size(), QFileSystemModelPrivate::size(), QSortFilterProxyModelPrivate::source_to_proxy(), QSortFilterProxyModel::span(), QAccessibleItemRow::state(), QScriptDebuggerLocalsModelPrivate::syncIndex(), QAccessibleItemRow::text_helper(), QFileSystemModelPrivate::time(), QAbstractItemView::timerEvent(), QAccessibleItemRow::treeLevel(), QFileSystemModel::type(), QFileSystemModelPrivate::type(), QAccessibleTable2::unselectColumn(), QAccessibleTable2::unselectRow(), QAbstractItemView::update(), QCalendarWidget::updateCell(), QAbstractItemViewPrivate::updateEditorData(), QAbstractItemView::updateEditorGeometries(), QStyledItemDelegate::updateEditorGeometry(), QItemDelegate::updateEditorGeometry(), QTreeViewPrivate::viewIndex(), QTableWidget::visualItemRect(), QColumnView::visualRect(), QTreeView::visualRegionForSelection(), and QHeaderView::visualRegionForSelection().

77 { return (r >= 0) && (c >= 0) && (m != 0); }
const QAbstractItemModel * m

◆ model()

const QAbstractItemModel * QModelIndex::model ( ) const
inline

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 76 of file qabstractitemmodel.h.

Referenced by QFileDialogPrivate::_q_enterDirectory(), QScriptDebuggerLocalsWidgetPrivate::_q_expandIndex(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(), QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeRemoved(), QIdentityProxyModelPrivate::_q_sourceColumnsInserted(), QIdentityProxyModelPrivate::_q_sourceColumnsMoved(), QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(), QIdentityProxyModelPrivate::_q_sourceDataChanged(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeInserted(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeMoved(), QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeRemoved(), QIdentityProxyModelPrivate::_q_sourceRowsInserted(), QIdentityProxyModelPrivate::_q_sourceRowsMoved(), QIdentityProxyModelPrivate::_q_sourceRowsRemoved(), QTableViewPrivate::accessibleTable2Index(), QIdentityProxyModel::columnCount(), QItemSelectionModel::columnIntersectsSelection(), QPersistentModelIndexData::create(), QTreeView::currentChanged(), QFileSystemModel::data(), QUrlModel::dataChanged(), QIdentityProxyModel::dropMimeData(), QFileSystemModelPrivate::filePath(), QListModel::flags(), QComboMenuDelegate::getStyleOption(), QAbstractTableModel::hasChildren(), QIdentityProxyModel::index(), QSortFilterProxyModelPrivate::index_to_iterator(), QAbstractItemModelPrivate::indexValid(), QIdentityProxyModel::insertColumns(), QIdentityProxyModel::insertRows(), QItemSelectionModel::isColumnSelected(), QAbstractItemViewPrivate::isIndexValid(), QItemSelectionModel::isRowSelected(), QItemSelectionModel::isSelected(), QStandardItemModelPrivate::itemFromIndex(), QStandardItemModel::itemFromIndex(), QSortFilterProxyModel::lessThan(), QAccessibleTable2::logicalIndex(), QIdentityProxyModel::mapFromSource(), QIdentityProxyModel::mapToSource(), QIdentityProxyModel::match(), QPersistentModelIndex::model(), QCommonListViewBase::modelIndex(), QItemSelectionRange::operator<(), operator<<(), QColumnViewDelegate::paint(), QIdentityProxyModel::parent(), QSortFilterProxyModelPrivate::proxy_to_source(), QIdentityProxyModel::removeColumns(), QIdentityProxyModel::removeRows(), rowAt(), QIdentityProxyModel::rowCount(), QDirModel::rowCount(), QItemSelectionModel::rowIntersectsSelection(), QFileDialogPrivate::select(), QItemSelection::select(), QTreeView::selectionChanged(), QDataWidgetMapper::setCurrentModelIndex(), QFileDialogComboBox::setHistory(), QFileDialogPrivate::setRootIndex(), QAbstractItemView::setRootIndex(), QAccessibleItemRow::setText(), QFileDialogComboBox::showPopup(), QSortFilterProxyModelPrivate::source_to_proxy(), QAccessibleItemRow::state(), QAccessibleTable2Cell::state(), QAccessibleItemRow::text(), and QAccessibleItemRow::text_helper().

76 { return m; }
const QAbstractItemModel * m

◆ operator!=()

bool QModelIndex::operator!= ( const QModelIndex other) const
inline

Returns true if this model index does not refer to the same location as the other model index; otherwise returns false.

Definition at line 80 of file qabstractitemmodel.h.

81  { return !(*this == other); }

◆ operator<()

bool QModelIndex::operator< ( const QModelIndex other) const
inline

Returns true if this model index is smaller than the other model index; otherwise returns false.

Since
4.1

Definition at line 82 of file qabstractitemmodel.h.

83  {
84  if (r < other.r) return true;
85  if (r == other.r) {
86  if (c < other.c) return true;
87  if (c == other.c) {
88  if (p < other.p) return true;
89  if (p == other.p) return m < other.m;
90  }
91  }
92  return false; }
const QAbstractItemModel * m

◆ operator==()

bool QModelIndex::operator== ( const QModelIndex other) const
inline

Returns true if this model index refers to the same location as the other model index; otherwise returns false.

All values in the model index are used when comparing with another model index.

Definition at line 78 of file qabstractitemmodel.h.

79  { return (other.r == r) && (other.p == p) && (other.c == c) && (other.m == m); }
const QAbstractItemModel * m

◆ parent()

QModelIndex QModelIndex::parent ( ) const
inline

Returns the parent of the model index, or QModelIndex() if it has no parent.

See also
child(), sibling(), model()

Definition at line 392 of file qabstractitemmodel.h.

Referenced by QColumnViewPrivate::_q_changeCurrentColumn(), QColumnViewPrivate::_q_clicked(), QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(), QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(), QDataWidgetMapperPrivate::_q_dataChanged(), QDeclarativeVisualDataModel::_q_dataChanged(), QTreeWidgetPrivate::_q_dataChanged(), QComboBoxPrivate::_q_dataChanged(), QFileDialogPrivate::_q_deleteCurrent(), QStandardItemModelPrivate::_q_emitItemChanged(), QScriptDebuggerScriptsWidgetPrivate::_q_onCurrentChanged(), QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(), QSortFilterProxyModelPrivate::_q_sourceDataChanged(), QAbstractItemModelPrivate::allowMove(), QAbstractItemModel::beginMoveColumns(), QAbstractItemModel::beginMoveRows(), QSortFilterProxyModelPrivate::can_create_mapping(), QColumnViewPrivate::closeColumns(), QAbstractItemModelPrivate::columnsAboutToBeInserted(), QAbstractItemModelPrivate::columnsAboutToBeRemoved(), QItemSelectionRange::contains(), QRowsRemoval::contains(), QSortFilterProxyModelPrivate::create_mapping(), QColumnView::currentChanged(), QHeaderView::currentChanged(), QUrlModel::dataChanged(), QTreeViewPrivate::draggablePaintPairs(), QListModeViewBase::dragMoveEvent(), QAbstractItemView::dragMoveEvent(), QTreeView::drawBranches(), QTreeView::drawRow(), QSortFilterProxyModel::dropMimeData(), QAbstractItemViewPrivate::dropOn(), QListModeViewBase::dropOn(), QAbstractItemViewPrivate::droppingOnItself(), QTreeModel::ensureSorted(), QFileSystemModelPrivate::filePath(), QScriptDebuggerLocalsModel::flags(), QDeclarativeFolderListModel::handleDataChanged(), QAccessibleTree::indexFromLogical(), QTreeView::indexRowSizeHint(), QTreeWidget::isFirstItemColumnSpanned(), QListView::isIndexHidden(), QTreeView::isIndexHidden(), QAccessibleTree::isRowSelected(), QTreeViewPrivate::itemDecorationRect(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QTreeView::keyboardSearch(), QAbstractItemView::keyboardSearch(), QCompletionModel::mapFromSource(), mergeIndexes(), QColumnView::moveCursor(), QTreeView::moveCursor(), QAccessibleItemRow::navigate(), ModelIndexIterator::next(), QItemSelectionRange::operator<(), QScriptDebuggerLocalsItemDelegate::paint(), QIdentityProxyModel::parent(), QItemSelectionRange::parent(), QPersistentModelIndex::parent(), QCompleter::pathFromIndex(), QListViewPrivate::rectForIndex(), QAccessibleTable2Cell::relationTo(), QTreeViewPrivate::removeViewItems(), rowAt(), QAbstractItemModelPrivate::rowsAboutToBeInserted(), QAbstractItemModelPrivate::rowsAboutToBeRemoved(), QAbstractItemView::rowsAboutToBeRemoved(), QColumnView::scrollTo(), QListView::scrollTo(), QTreeView::scrollTo(), QTreeViewPrivate::select(), QItemSelection::select(), QColumnView::selectAll(), QTreeView::selectAll(), QTableView::selectedIndexes(), QListView::selectedIndexes(), QTreeView::selectedIndexes(), QComboBoxPrivate::setCurrentIndex(), QDataWidgetMapper::setCurrentModelIndex(), QDirModel::setData(), QFileSystemModel::setData(), QTreeWidget::setFirstItemColumnSpanned(), QTreeWidget::setItemHidden(), QListView::setPositionForIndex(), QFileDialogComboBox::showPopup(), QSortFilterProxyModelPrivate::source_to_proxy(), QAccessibleItemRow::treeLevel(), QSortFilterProxyModelPrivate::update_persistent_indexes(), QAbstractItemViewPrivate::updateEditorData(), QTableView::visualRect(), and QListView::visualRegionForSelection().

393 { return m ? m->parent(*this) : QModelIndex(); }
QModelIndex()
Creates a new empty model index.
const QAbstractItemModel * m
virtual QModelIndex parent(const QModelIndex &child) const =0
Returns the parent of the model item with the given index.

◆ row()

int QModelIndex::row ( ) const
inline

Returns the row this model index refers to.

Definition at line 67 of file qabstractitemmodel.h.

Referenced by QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(), QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(), QCompleterPrivate::_q_complete(), QListWidgetPrivate::_q_dataChanged(), QDeclarativeVisualDataModel::_q_dataChanged(), QTableWidgetPrivate::_q_dataChanged(), QTreeWidgetPrivate::_q_dataChanged(), QComboBoxPrivate::_q_dataChanged(), QScriptBreakpointsWidgetPrivate::_q_deleteBreakpoint(), QFileDialogPrivate::_q_deleteCurrent(), QComboBoxPrivate::_q_emitCurrentIndexChanged(), QListWidgetPrivate::_q_emitCurrentItemChanged(), QTableWidgetPrivate::_q_emitCurrentItemChanged(), QComboBoxPrivate::_q_emitHighlighted(), QListWidgetPrivate::_q_emitItemActivated(), QTableWidgetPrivate::_q_emitItemActivated(), QListWidgetPrivate::_q_emitItemChanged(), QStandardItemModelPrivate::_q_emitItemChanged(), QTableWidgetPrivate::_q_emitItemChanged(), QListWidgetPrivate::_q_emitItemClicked(), QTableWidgetPrivate::_q_emitItemClicked(), QListWidgetPrivate::_q_emitItemDoubleClicked(), QTableWidgetPrivate::_q_emitItemDoubleClicked(), QListWidgetPrivate::_q_emitItemEntered(), QTableWidgetPrivate::_q_emitItemEntered(), QListWidgetPrivate::_q_emitItemPressed(), QTableWidgetPrivate::_q_emitItemPressed(), QHeaderViewPrivate::_q_layoutChanged(), QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsDataChanged(), QScriptDebuggerStackWidgetPrivate::_q_onCurrentChanged(), QFileDialogPrivate::_q_renameCurrent(), QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(), QSortFilterProxyModelPrivate::_q_sourceDataChanged(), QTableViewPrivate::accessibleTable2Index(), QAbstractItemModelPrivate::allowMove(), QAbstractItemModel::beginMoveColumns(), QAbstractItemModel::beginMoveRows(), QSortFilterProxyModelPrivate::can_create_mapping(), QSidebar::clicked(), QAbstractItemModelPrivate::columnsInserted(), QAbstractItemModelPrivate::columnsRemoved(), QItemSelectionRange::contains(), QRowsRemoval::contains(), QFontListView::currentChanged(), QHeaderView::currentChanged(), QAbstractItemView::currentChanged(), QFontListView::currentItem(), QTableWidget::currentRow(), QFontListView::currentText(), QStringListModel::data(), QUndoModel::data(), QSqlQueryModel::data(), QScriptDebuggerStackModel::data(), QSqlTableModel::data(), QSqlRelationalTableModel::data(), QDeclarativeFolderListModel::data(), QScriptBreakpointsModel::data(), QListModel::data(), ControlList::data(), QCalendarModel::data(), QUrlModel::dataChanged(), QTreeView::dataChanged(), QHeaderView::dataChanged(), QIconModeViewBase::dataChanged(), QAbstractItemViewPrivate::delegateForIndex(), QTreeViewPrivate::draggablePaintPairs(), QTreeView::drawBranches(), QTreeView::drawRow(), QTableWidget::dropEvent(), QListModel::dropMimeData(), QSortFilterProxyModel::dropMimeData(), QTableModel::dropMimeData(), QAbstractTableModel::dropMimeData(), QAbstractListModel::dropMimeData(), QAbstractItemViewPrivate::dropOn(), QListModeViewBase::dropOn(), QComboBoxPrivate::emitActivated(), QTreeModel::emitDataChanged(), QAbstractItemModel::endMoveColumns(), QAbstractItemModel::endMoveRows(), QListModel::ensureSorted(), QTreeModel::ensureSorted(), QCompleter::eventFilter(), QScriptDebuggerLocalsWidget::expand(), QSortFilterProxyModelPrivate::filter_changed(), QIconModeViewBase::filterDropEvent(), QComboBox::findData(), QListWidget::findItems(), QSqlTableModel::flags(), QListModel::flags(), QCalendarModel::flags(), QCalendarWidgetPrivate::getCurrentDate(), QComboMenuDelegate::getStyleOption(), QDeclarativeFolderListModel::handleDataChanged(), QCalendarView::handleMouseEvent(), QAbstractProxyModel::headerData(), QFileSystemModel::index(), QDirModel::index(), QTreeView::indexAt(), QAccessibleTree::indexFromLogical(), QSqlQueryModel::indexInQuery(), QSqlTableModel::indexInQuery(), QTreeView::indexRowSizeHint(), QListModeViewBase::indexToListViewItem(), QIconModeViewBase::indexToListViewItem(), QListViewPrivate::indexToListViewItem(), QAbstractItemModelPrivate::indexValid(), QSqlTableModel::isDirty(), QTreeWidget::isFirstItemColumnSpanned(), QTableView::isIndexHidden(), QListView::isIndexHidden(), QTreeView::isIndexHidden(), QAbstractItemViewPrivate::isIndexValid(), QAccessibleTree::isRowSelected(), QTableModel::isValid(), QTableModel::item(), QListModel::itemData(), QStandardItemModelPrivate::itemFromIndex(), QListWidget::itemFromIndex(), QStandardItemModel::itemFromIndex(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QAbstractItemView::keyboardSearch(), QComboBoxPrivate::keyboardSearchString(), QScriptBreakpointsWidget::keyPressEvent(), QTreeViewPrivate::layout(), QInputDialogPrivate::listViewText(), QAccessibleTable2::logicalIndex(), QIdentityProxyModel::mapFromSource(), QCompletionModel::mapFromSource(), QIdentityProxyModel::mapToSource(), QCompletionModel::mapToSource(), QAbstractItemModel::match(), mergeIndexes(), QListModel::mimeData(), QTreeViewPrivate::modelIndex(), QColumnView::moveCursor(), QTableView::moveCursor(), QTreeView::moveCursor(), QCalendarView::moveCursor(), QAbstractItemModelPrivate::movePersistentIndexes(), QAccessibleItemRow::navigate(), ModelIndexIterator::next(), operator<<(), QCalendarDelegate::paint(), QCompleter::pathFromIndex(), QSqlQueryModelPrivate::prefetch(), QSortFilterProxyModelPrivate::proxy_to_source(), qContainsIndex(), qHash(), QListViewPrivate::rectForIndex(), QPersistentModelIndex::row(), rowAt(), QAccessibleTable2Cell::rowColumnExtents(), QAccessibleTable2Cell::rowHeaderCells(), QAccessibleTable2Cell::rowIndex(), QAbstractItemModelPrivate::rowsAboutToBeInserted(), QAbstractItemModelPrivate::rowsAboutToBeRemoved(), QAbstractItemView::rowsAboutToBeRemoved(), QAbstractItemModelPrivate::rowsInserted(), QAbstractItemModelPrivate::rowsRemoved(), QTableView::scrollTo(), QTreeViewPrivate::select(), QItemSelection::select(), QTreeView::selectAll(), QAccessibleItemView::selectedColumns(), QListWidget::selectedItems(), QAccessibleTable2::selectedRows(), QAccessibleItemView::selectedRows(), QListViewPrivate::selection(), QTableViewPrivate::selectRow(), QComboBoxPrivate::setCurrentIndex(), QListWidget::setCurrentItem(), QDataWidgetMapper::setCurrentModelIndex(), QStringListModel::setData(), QSqlTableModel::setData(), QDirModel::setData(), QScriptBreakpointsModel::setData(), QListModel::setData(), QTableModel::setData(), QTreeWidget::setFirstItemColumnSpanned(), QAbstractProxyModel::setHeaderData(), QTableModel::setItemData(), QTreeWidget::setItemHidden(), QIconModeViewBase::setPositionForIndex(), QSqlQueryModel::setQuery(), QTableView::setSelection(), QTreeView::setSelection(), QUndoModel::setStackCurrentIndex(), QFileDialogComboBox::showPopup(), QTreeView::sizeHintForColumn(), QTableView::sizeHintForRow(), QStringListModel::sort(), QFileSystemModel::sort(), QSortFilterProxyModelPrivate::source_to_proxy(), QAccessibleItemRow::state(), QSortFilterProxyModelPrivate::updateChildrenMapping(), QAbstractItemViewPrivate::updateEditorData(), QTreeViewPrivate::viewIndex(), QTableView::visualIndex(), QListView::visualIndex(), QTreeWidget::visualItemRect(), QTableView::visualRect(), QListView::visualRegionForSelection(), QTreeView::visualRegionForSelection(), and QCalendarView::wheelEvent().

67 { return r; }

◆ sibling()

QModelIndex QModelIndex::sibling ( int  row,
int  column 
) const
inline

Returns the sibling at row and column.

If there is no sibling at this position, an invalid QModelIndex is returned.

See also
parent(), child()

Definition at line 395 of file qabstractitemmodel.h.

Referenced by QCompleterPrivate::_q_complete(), QFileDialogPrivate::_q_deleteCurrent(), QFileDialogPrivate::_q_renameCurrent(), QSqlTableModel::data(), QFileSystemModel::index(), QDirModel::index(), QTreeView::indexAt(), QTreeViewPrivate::modelIndex(), QColumnView::moveCursor(), QTreeView::moveCursor(), QCompleter::pathFromIndex(), QScriptDebuggerLocalsModelPrivate::reallySyncIndex(), rowAt(), QTreeViewPrivate::select(), QItemSelection::select(), QTreeView::selectAll(), QDirModel::setData(), QTreeView::setSelection(), QPersistentModelIndex::sibling(), QTreeView::sizeHintForColumn(), QFileSystemModel::sort(), QTreeViewPrivate::viewIndex(), and QTreeWidget::visualItemRect().

396 { return m ? (r == arow && c == acolumn) ? *this : m->index(arow, acolumn, m->parent(*this)) : QModelIndex(); }
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
QModelIndex()
Creates a new empty model index.
const QAbstractItemModel * m
virtual QModelIndex parent(const QModelIndex &child) const =0
Returns the parent of the model item with the given index.

Friends and Related Functions

◆ QAbstractItemModel

friend class QAbstractItemModel
friend

Definition at line 60 of file qabstractitemmodel.h.

◆ QModelIndexList()

QModelIndexList
related

Synonym for QList<QModelIndex>.

◆ QProxyModel

friend class QProxyModel
friend

Definition at line 61 of file qabstractitemmodel.h.

Properties

◆ c

int QModelIndex::c
private

Definition at line 95 of file qabstractitemmodel.h.

Referenced by operator<(), operator==(), and sibling().

◆ m

const QAbstractItemModel* QModelIndex::m
private

◆ p

void* QModelIndex::p
private

Definition at line 96 of file qabstractitemmodel.h.

Referenced by operator<(), and operator==().

◆ r

int QModelIndex::r
private

Definition at line 95 of file qabstractitemmodel.h.

Referenced by operator<(), operator==(), and sibling().


The documentation for this class was generated from the following files: