[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 21:43:16 CEST 2009


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



More information about the Qt-interest-old mailing list