[Qt-interest] QVBoxLayout with 100s of items is hanging
Andre Somers
andre at familiesomers.nl
Tue Dec 1 10:03:28 CET 2009
Hi "Quest",
Qt Quest wrote:
> Hi André,
>
> Yes! At first I didnt see that KWidgetItemDelegate uses the pool (and
> not the other way around). I built a demo application which is working
> - Thanks!
>
> I'm noticing few things which are disturbing:
> 1. Allocation - for every row createItemWidgets() is being called
> which takes a lot of time and memory.
>
> 2. Continuing point 1 above: It takes a lot of time to draw the list:
> 100 items: 0.5 sec
> 1000 items: 8 sec
> 10000 items: 60+ sec
> I've put counters in the create..() method and it is indeed called for
> every row.
>
> I'm sure we can cut the processing time considerably.
> I'm thinking of reusing the shown widget for all the 100s of lines
> (e.g. 2 widgets * 30 visible lines = 60 widgets created only once).
> What do you think?
> Thanks!
I agree that it is unfortunate that it works this way, but I guess it
was never meant to be used for lists the size you use. I never noticed
it as a problem, because my lists are limited to a dozen or two items.
Sorry to have lead you down the wrong path for your situation...
I think that it is going to be more trouble than it is worth to try to
get KWidgetItemDelegate to behave the way you want, but who knows...
Please let us know if you manage to do this!
What I would do, is try to implement a delegate based on QTextDocument's
rich text rendering or by looking at the internals of QLabel. The tricky
part will be getting the hyperlinks to work, I think. Note: I did not
try this myself!
I think I might try to create such a delegate at one point though, as I
think it would come in handy more often...
André
More information about the Qt-interest-old
mailing list