[Qt-interest] how to make sure wait cursor displays while all QGraphicsItem are being set to visible
Cecilia Castillo
castillo23 at llnl.gov
Thu Apr 9 23:31:52 CEST 2009
Sean -
Thanks, however, it does not seem to work. In fact, the items are
not being draw at all sometimes.
However, while reading the documentation I noticed the
FullViewportUpdate mode. I did try setting the viewport update mode
to FullViewportUpdate and that has made the redrawing of the items so
much faster so that the wait cursor is not so necessary. I will have
to see how my largest example runs next week.
Thanks for your pointers.
Cecilia
>You might want to look into
>QGraphicsView::setViewportUpdateMode(ViewportUpdateMode mode) and turn
>off updates *before* you iterate through your items, then turn it back
>on after you've finished toggling the visibility of each item.
>Something like:
>
>QGraphicsView::ViewportUpdateMode currMode =
>myGraphicsView->viewportUpdateMode(); // get current mode
>myGraphicsView->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
>// iterate through items here
>myGraphicsView->setViewportUpdateMode(currMode);
>myGraphicsView->repaint();
>
>This is completely untested (and written in Outlook!), but the idea is
>to not allow the QGraphicsView to redraw each item's change in
>visibility until their all turned on/off.
>Sean
>
>-----Original Message-----
>From: qt-interest-bounces at trolltech.com
>[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Cecilia Castillo
>Sent: Thursday, April 09, 2009 3:43 PM
>To: qt-interest at trolltech.com
>Subject: [Qt-interest] how to make sure wait cursor displays while all
>QGraphicsItem are being set to visible
>
>I have a qt application which contains a QGraphicsView and many, many
>QGraphicsItems. I have a toggle switch which allows the user to
>hide/display a large number of the QGraphicsItems. Sometimes it
>takes a few minutes to display all the QGraphicsItems if there are a
>lot (thousands) of items. To implement the hide/show of these
>items I simply iterate over all the QGraphicsItems in the View and
>call setVisible().
>
>
>I have attempted to set the wait cursor until the items are
>displayed...but it seems that the setVisible() function takes no
>time. What takes all the time is the QGraphicsItems paint events
>which are queued. However, I cannot seem to figure out how to insure
>that the clock cursor is active until all the paint events have been
>processed. I have tried calling QGraphicsView::repaint() but it does
>not seem to ensure that the QGraphicsItems paint events to be
>processed. In fact, there does not seem to be a repaint() method on
>QGraphicsItem leading me to believe that you cannot force the paint
>event to be processed and must let them be queued.
>
>Can anyone give me advice on how I can tell when all the
>QGraphicsItem paint events have been processed.
>
>Thanks,
> Cecilia
>_______________________________________________
>Qt-interest mailing list
>Qt-interest at trolltech.com
>http:// lists.trolltech.com/mailman/listinfo/qt-interest
>
>_______________________________________________
>Qt-interest mailing list
>Qt-interest at trolltech.com
>http:// lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list