Does QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap & pixmap, QGraphicsItem * parent = 0) perform a Deep Copy of pixmap
detaos last edited by
I'm considering implementing a ResourceManager class to store all of the QPixmaps which would appear in my game, but am wondering if the constructor QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap & pixmap, QGraphicsItem * parent = 0) performs a deep copy of the pixmap parameter. It seems pretty wasteful to me for each QGraphicsPixmapItem to store its own copy of the QPixmap, but the constructor accepts a constant reference instead of a pointer and QGraphicsPixmapItem::pixmap() returns a copy, not a (constant) reference of its QPixmap.
t3chNo last edited by
QPixmap uses implicit sharing, so if pixmap doesn't change, all graphicsitems use the same pixmap.
danilocesar last edited by
It seems your goal is to have something as "QPixmapCache":http://doc.trolltech.com/4.6-snapshot/qpixmapcache.html, isn't it?