[Qt-interest] QGraphicsItem and Threads
Brad Howes
howes at ll.mit.edu
Mon Oct 19 17:35:34 CEST 2009
On Oct 19, 2009, at 11:22 AM, Ole Streicher wrote:
> That works for me. Do I still need to use brush.moveToThread()
> somewhere?
I don't think so, because Qt's implicit sharing model is thread-safe,
though I am not sure about the mechanism by which it accomplishes
this. I believe, but do not know for a fact, that you will have two
QBrush objects, one in the creator thread, and one in the asynchronous
slot thread, with the same values but different thread ownerships.
Based on your code, an even better approach would be to just emit the
colors and not the QBrush objects, and have the items just update
their brush to use the new color. You save on object creation /
destruction.
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