Assuming the selection behaviour is SelectRows:
QModelIndexList selectedIndexes = view->selectionModel()->selectedRows();
QModelIndexList selectedIndexes = view->selectionModel()->selectedRows();
To copy to clipboard, switch view to plain text mode
Then you have a list of indexes in the first column for rows in the selection.
You could iterate over the indexes extracting the row() from each adding it to a QList<int>. Sort the list in descending order. Delete the rows.
Or you could just use the sort order provided by QModelIndex itself:
qSort(selectedIndexes.begin(), selectedIndexes.end(), qGreater<QModelIndex>());
qSort(selectedIndexes.begin(), selectedIndexes.end(), qGreater<QModelIndex>());
To copy to clipboard, switch view to plain text mode
If the selection behaviour is not SelectRows then call
QModelIndexList selectedIndexes = view->selectionModel()->selectedIndexes();
QModelIndexList selectedIndexes = view->selectionModel()->selectedIndexes();
To copy to clipboard, switch view to plain text mode
and build a list of unique row numbers by iterating over that list.
Bookmarks