I would like to get a QModelIndexList from a QStandartItemModel object. Latter is a table and I need the indices of its first columns of all (not only the selected!) rows. I may use QAbstractItemModel::match method, but is not there a more efficient way to get all indices of a model object?
For the time being I use this awkward way to get it:
QModelIndexList indices;
for (int i=0; i<model->rowCount(); i++){
indices << model->indexFromItem(model->item(i, 0));
}
QModelIndexList indices;
for (int i=0; i<model->rowCount(); i++){
indices << model->indexFromItem(model->item(i, 0));
}
To copy to clipboard, switch view to plain text mode
Bookmarks