PDA

View Full Version : QTableWidget optimize



stevocz
11th November 2014, 10:30
Hi.
I have in my application around 6 QTableWidget, where are more than 1000 rows in each table. but when i add new row or recreate table, is it too slow. is possible optimize QTableWidget?

sorting is enabled.
i used insertRow() and setItem() for adding new row

wysota
11th November 2014, 10:35
You can possibly get it faster by replacing QTableWidget with QTableView and implementing a proper model for it.

stevocz
11th November 2014, 10:37
and without QTableView ?

wysota
11th November 2014, 11:07
Depends what you do with QTableWidget. But in general it is meant to be a convenience replacement for QTableView in simple situations. As the flow gets complex, users should switch to QTableView.

JohnToddSr
13th November 2014, 05:04
You may want to try turning off sorting before inserting/creating.
Then turn sorting back on after inserts/creates are finished.