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:

Qt Code:
  1. QModelIndexList indices;
  2. for (int i=0; i<model->rowCount(); i++){
  3. indices << model->indexFromItem(model->item(i, 0));
  4. }
To copy to clipboard, switch view to plain text mode