PDA

View Full Version : Many cell widget in QTableWidget



Benarez
20th January 2010, 17:13
Hello,

I have a short question about QT tables (or more precise QTableWidget). I need to build a table with about 12 000 lines and every line has a checkbox (cell widget) in it. But these checkboxes make the tablewidget very slow about half a minute until the window is redrawn. Is there a possibility to get this faster or should the concept be revised?
I am using Windows XP. Under Linux this effect does not occur.

Regards,
Benarez

tsp
20th January 2010, 18:10
Have you tried to use QTableWidgetItem (instead of cell widget) and use its checked state (QTableWidgetItem::setCheckState), is there any difference in the speed?

faldzip
20th January 2010, 23:44
If you want good performance, then implement your own custom model where you have to return proper flags for checkable items (ItemIsUserCheckable) and proper values in data() for Qt::CheckStateRole and set proper things in your underlaying model structure for Qt::CheckStateRole. Then set this model to QTableView

Benarez
21st January 2010, 08:02
Using QTableWidgetItem instead of cell widget already brought enough performance for me (for now). I will keep in mind implementing a new model for the table if I need even more performance.
Thanks for the help.

Regards,
Benarez