If you used "select rows" selection behavior you could simply use QItemSelectionModel::selectedRows(). If not, you could use for example a set:
QSet<int> rows;
const QModelIndexList list = table->selectionModel()->selection().indexes();
for (int i = 0; i < list.count(); i++)
{
rows.insert(index.row());
}
qDebug() << rows;
QSet<int> rows;
const QModelIndexList list = table->selectionModel()->selection().indexes();
for (int i = 0; i < list.count(); i++)
{
QModelIndex index = list.at(i);
rows.insert(index.row());
}
qDebug() << rows;
To copy to clipboard, switch view to plain text mode
Bookmarks