Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, March 2007
Delay Redraw of QGraphicsScene?


Message 1 in thread

Can I enqueue updates to a QGraphicsScene before it is redrawn? 
Specifically, I would like to delay redrawing the scene while I 
reposition, show, and hide thousands of items.  Currently, after each 
change to the scene, Qt redraws the entire scene.  I would like to delay 
this until all the graphicsitem's settings are set, then redraw the 
scene only once.  Is there a way to do this?  Any help would be greatly 
appreciated.
-Chris Portka

--
 [ signature omitted ] 

Message 2 in thread

Chris Portka wrote:
> Can I enqueue updates to a QGraphicsScene before it is redrawn? 
> Specifically, I would like to delay redrawing the scene while I 
> reposition, show, and hide thousands of items.  Currently, after each 
> change to the scene, Qt redraws the entire scene.  I would like to 
> delay this until all the graphicsitem's settings are set, then redraw 
> the scene only once.  Is there a way to do this?  Any help would be 
> greatly appreciated.

Qt should optimize paintEvents for you, but if you want you can do the 
following:

scene->blockSignals(true);
//Do long opertaions
scene->blockSignals(false);
scene->update();   //Force one huge update

--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard