QTableWidget is model-less, and I run into similar situations to this question, there is no functions to erase multiple rows simultaneously, only a:
void QTableWidget::removeRow ( int row )
And there's no persistent index I think, what to do now?
QTableWidget is model-less, and I run into similar situations to this question, there is no functions to erase multiple rows simultaneously, only a:
void QTableWidget::removeRow ( int row )
And there's no persistent index I think, what to do now?
You should get a list of selected items and then iterate through each of them and delete the pointer to each item. For example:
foreach(QTableWidgetItem * item, tableWidget.selectedItems())
{
delete item;
}
It's safe to delete the pointer directly as I've used this method to delete similar items from QTreeWidgets and QListWidgets.
Hope this helps.