[Qt-interest] Displaying (and scrolling through) a fraction of the total number of graphics items in a graphics view

Andreas Unger andi.unger05 at gmail.com
Tue Mar 2 11:50:24 CET 2010


Hello,

I have a device with limited memory, and as such I cannot display a large
number of QGraphicsItems (custom GraphicsItems with background and
foreground images and text).

I've also created a basic QGraphicsItem scrollbar (emits signals when its
scrolled up/down and the maximum value, step size can be set).

I display a bunch of QGraphicsItems in two modes:

* 6 QGraphicsItems per row, 3 maximum rows per page
* 1 GraphicsItem per row, 8 maximum rows per page

>From a list of item attributes, I only instantiate the visible
QGraphicsItems and I add these items to a displayed items list.

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.

I'm finding that all the logic of checking what display mode I'm in,
deleting items at the top/bottom of the displayed items list, shifting the
remaining items in the list up or down, instantiating new items and adding
them to the top/bottom of the list every time a user scrolls is getting very
unwieldy.

I hope explained myself well enough. Is there a better way of doing this?

Thanks,
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100302/3d19e439/attachment.html 


More information about the Qt-interest-old mailing list