Penalty of using QGraphicsObject vs QGraphicsItem?
Posted
by Dutch
on Stack Overflow
See other posts from Stack Overflow
or by Dutch
Published on 2010-02-18T20:46:42Z
Indexed on
2010/04/18
9:13 UTC
Read the original article
Hit count: 362
I currently have a hierarchy of items based off of QGraphicsItem.
I want to move to QGraphicsObject instead so that I can put properties on my items. I will not be making use of signals/slots or any other features of QObject.
I'm told that you shouldn't derive from QObject because it's "heavy" and "slow".
To test the impact, I derive from QGraphicsObject, add a couple properties to my items, and look at the memory usage of the running app. I create 1000 items using both flavors and I don't notice anything more than 10k more memory usage.
Since all I am adding on to my items are properties, is it safe to say that QObject only adds weight if you are using signals/slots?
© Stack Overflow or respective owner