[Qt-interest] Displaying (and scrolling through) a fraction of the total number of graphics items in a graphics view
Girish Ramakrishnan
girish at forwardbias.in
Tue Mar 2 14:02:41 CET 2010
Hi,
Andreas Unger wrote:
> Hello,
>
> As the user scrolls up or down, I delete a number of items at the top or
> bottom of the displayed items list and instantiate new QGraphicsItems
> that are added at the top or bottom of the displayed items list
> depending on the scroll direction.
>
Why delete the items? Keep the items in the scene. Have a timer in the
scene/view that unload invisible items periodically. You can have the
items load themselves automatically in their ::paint (unless the
resources take a lot of time to load in which you have to think of
alernatives). The scrolling itself can be implemented by adjusting the
scene rect of the view or create an item that takes advantage of
QGraphicsItem::scroll.
QGraphicsItem by itself consumes hardly any memory. like 20 bytes or
something.
Girish
More information about the Qt-interest-old
mailing list