Removing huge number of rows from QTableWidget
-
Hello
I have cell rows created in order of 10M+. Now if user selects and deletes , deleting each row is becoming a very heavy task. I dont want to use clear() or clearContents() , since that would be applicable for all selections. Am not sure how Qt does that so quickly in case of clear(), but if i iterate over selected contents and call removeRow its becoming very heavy .I saw over google a suggestion of directly using models removeRows() function. Is it safe to do that ?
yourtable->model()->removeRows(0, yourtable->rowCount());Any other better ways to delete contents of such huge number.
Thanks !! -
Yes that is fine, removeRows() is exactly for that purpose and internally it will do a block update that will optimize the updates sent back to the view.
I am sure that the model QTableWidget implements removeRows() but just in case you should check the return value is
true
so that you know that it has succeeded.