[Qt-interest] Slow QTreeWidget

RZ rz at razfazz.at
Wed Mar 25 18:09:30 CET 2009


I'm reading files a few mb's in size; results in some 100000 rows (each 
10 columns).
Parsing the file and filling the model takes about 10 seconds; before i 
blocked the signals it took minutes.


> RZ wrote:
>> In my case I had a model and a view (maybe you could do that too) and 
>> the setUpdatesEnabled didn't help that much - so I added two more lines:
>>
>> model->blockSignals(true);
>> setUpdatesEnabled(false);
>> bigVisualChanges(); // loop with your addResultRow call
>> setUpdatesEnabled(true);
>> model->blockSignals(false);
>>
>> The effect was more than significant .....
> Thanks to both for the suggestions.
> 
> setUpdatesEnabled(false) did not do much, except to delay the visual 
> update until the end. I have a progress bar that steps with each row 
> add, and the time between steps gets progressively slower as rows get 
> added, again as if it is looping back to somehow update all the previous 
> data with each call to setText.
> 
> This is currently NOT a model/view, it was a pretty simple display of 
> data. I will try the model/view approach.
> 
> Just a further comment -- this is REALLY slow -- I only have 14 rows, 
> and close to 50 columns, and it takes 2-3 minutes to populate the table. 
>  Surely there must be some way to improve performance here. You would 
> think that a set text on a given row would not have to involve the other 
> rows in a TableWidget or TreeWidget.



More information about the Qt-interest-old mailing list