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

Andre Somers andre at familiesomers.nl
Thu Dec 3 10:06:26 CET 2009


Qt Quest wrote:
> Hi André,
> Please dont apologize, you meant only good, and I appreciate it!
> Do you know how can I test for visibility on the viewport of an item 
> in the list? That way I can cache the visible items (30-40 items) and 
> use only them.
> Thanks for the effort!
>
> ------------------------------------------------------------------------
> *From:* Andre Somers <andre at familiesomers.nl>
> *To:* Qt-interest <qt-interest at trolltech.com>
> *Sent:* Tue, December 1, 2009 11:03:28 AM
> *Subject:* Re: [Qt-interest] QVBoxLayout with 100s of items is hanging
>
> Hi "Quest",
>
> Qt Quest wrote:
> > Hi André,
> > ...
> > 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...
I was intrigued enough to try it, and I am making very good progress. It 
is not done yet, but I think I will have a working rich text delegate 
complete with hyperlinks quite soon. I am using the QTextDocument route. 
Internally, QLabel uses one too, and using the hyperlinks is not all 
that difficult it turns out. When I am done, I will publish the code.

André




More information about the Qt-interest-old mailing list