How can I delete several rows from QTableWidget at the same time?
Hi dudes!
I have a QTableWidget, and using:
QList<QTableWidgetSelectionRange> ranges=ui.tableWidgetTextureLibrary->selectedRanges();
I know what rows are selected (indexes), but obviusly I can't do
ui.tableWidgetTextureLibrary->removeRow(row);
Because once I do it, my rows to delete list, is not valid.
Does anyone have any suggestion?
I guess I colud do something using an auxiliar struct... But must be an easier way.
Thanks for help.
Re: How can I delete several rows from QTableWidget at the same time?
You can start deleting from the last row. In that case the indexes will stay valid.
Or you can probably just delete the items returned by QTableWidget::selectedItems() using qDeleteAll().
Re: How can I delete several rows from QTableWidget at the same time?
Used sorted version and evidently worked.
I don't know why I didn't have that idea.
Thanks a lot for your help.