I want to delete rows in QTableWidget
between a range.
The only problem here is that deleting row by row...takes very long time.
Is there a way to make this faster by deleting between a range? I want to delete rows from toRow
to fromRow
, where toRow > fromRow
/* Create progress bar */
QProgressDialog progress("Loading table...", "Abort loading", fromRow, toRow, this);
progress.setWindowModality(Qt::WindowModality::ApplicationModal);
/* Delete */
if(database->deleteRowsBetweenID(fromID, toID)){
/* Remove each row */
for(int i = toRow; i >= fromRow; i--){
ui->measurementTableWidget->removeRow(i);
/* Break the process */
if (progress.wasCanceled())
break;
else
progress.setValue(toRow - i);
}
/* Close the progress bar */
progress.setValue(toRow);