[Qt-interest] QVBoxLayout with 100s of items is hanging

Andre Somers andre at familiesomers.nl
Thu Nov 26 13:05:43 CET 2009


Qt Quest wrote:
> Hi David,
>
> Thanks for your response.
> Indeed a text edit was my first thought and implementation, however I 
> also have checkboxes etc. on every line that I have to interact with.
> The performance of the QVBoxLayout seem to be of O(n^2) which is 
> inefficient. I'm sure there's a simple bug fix to bring it up to O(n), 
> but I dont know the class' internal too.
>
> QLayout::invalidate is being called in the process which zeroes out 
> the layout geometry.
>
> Has anyone has any input on the layout internals?
>
> Thanks in advance!
I could be that QLayout is fixable, but perhaps you should re-think your 
GUI design a bit.
Interacting with lists of hundreds or thousands of items with checkboxes 
is not something I'd like to throw on my users. If you need checkboxes: 
A QListView can show them. That may be a far better way of dealing with 
this.

Otherwise, perhaps you can considder using a QGraphicsView and put your 
widgets on there. There at least you'll get some optimization in the 
drawing.

André




More information about the Qt-interest-old mailing list