[Qt-interest] QGraphicsItem and Threads
Brad Howes
howes at ll.mit.edu
Mon Oct 19 16:57:39 CEST 2009
On Oct 19, 2009, at 9:14 AM, Ole Streicher wrote:
> I am trying to change lots of QGraphicsItems at once:
>
> for item in self.items:
> item.setBrush(QtGui.QBrush(QtGui.QColor(c[0], c[1], c[2]))
<snip>
> What is wron here? And how can I make huge graphical changes (100.000
> items) without getting my GUI unresponsive?
First, try to determine where the slow-down occurs. If the brush is
the same for all of your objects, then it is a bit silly to have to
create 100K brushes; adapt your objects to use a common brush instead.
If not, try making the brush update an asynchronous signal/slot; that
way, you remain response as the application tries to deliver the
signal to the 100K objects. Also, try controlling the updates of the
view. Check out the QGraphicsView API (viewportUpdateMode and
optimization flags in particular).
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