QModelIndex index = model->index(0, 0); // accessing data in first row and first column QString data = model->data(index).toString(); // retrieving data from model using QModelIndex
QModelIndex index = model->index(0, 0); QModelIndex viewIndex = proxyModel->mapFromSource(index); // map QModelIndex to a viewIndex in a proxy model QModelIndex modelIndex = proxyModel->mapToSource(viewIndex); // map viewIndex back to a QModelIndex in the original modelHere, we use the QModelIndex object to map an index from a QAbstractItemModel to a view index in a QSortFilterProxyModel, and vice versa. The package library for QModelIndex is part of the Qt Core module in the Qt framework.