[Qt-interest] QGraphicsItem and Threads

Brad Howes howes at ll.mit.edu
Tue Oct 20 19:49:01 CEST 2009


On Oct 20, 2009, at 12:39 PM, Jason H wrote:

> Well you bring up a good point. To change the color of many items,  
> they probably have to use a shared brush. Then it is just a matter  
> of fast assignment of one single brush,  but then you have to  
> iterate over all the objects using that brush, and reset the brush  
> to the shared brush.
>
> You may have to reimplement the item class to allow the use of a  
> brush pointer. This should get around the implicit-sharing semantics.


I did something similar for a Qt3 Canvas application used to show  
airport traffic on taxiways and runways. The sprite objects held a  
pointer to a settings object that defined the visual characteristics  
such as color, font, etc. Changing the settings object signaled the  
sprites to update themselves. Works great, though there will be some  
work to move it to GraphicsView. I can only compile it on my Mac OS X   
laptop under Snow Leopard after judicious judo to the build system to  
keep everything at 32 bits.

Still, the division of labor in an MVC sort of way is powerful, and it  
is something I would keep in the port to GraphicsView.

Brad

-- 
Brad Howes
Group 42
MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420








More information about the Qt-interest-old mailing list