I have a QStandardItemModel with 10000 Rows. If I want to remove a huge percent of these like 5000 the performance is very bad and the gui freezes. I could run the remove in a thread, but I am concerned what could happend if a user clicks a row that is going to be removed shortly.
QModelIndexList indexes = ui->playTableView->selectionModel()->selectedRows();
for (int i=0; i<indexes.count(); i++) {
if (!ui->playTableView->isRowHidden(indexes[i].row()) ) {
plmodel->removeRow(indexes[i].row());
}
}
QModelIndexList indexes = ui->playTableView->selectionModel()->selectedRows();
for (int i=0; i<indexes.count(); i++) {
if (!ui->playTableView->isRowHidden(indexes[i].row()) ) {
plmodel->removeRow(indexes[i].row());
}
}
To copy to clipboard, switch view to plain text mode
This works, but takes very long time; maybe 30 seconds. it gives a bad user experience. Is there a faster way?
any ideas?
Bookmarks