Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Does QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap & pixmap, QGraphicsItem * parent = 0) perform a Deep Copy of pixmap
QtWS25 Last Chance

Does QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap & pixmap, QGraphicsItem * parent = 0) perform a Deep Copy of pixmap

Scheduled Pinned Locked Moved Game Development
3 Posts 3 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    detaos
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3chNo
      wrote on last edited by
      #2

      QPixmap uses implicit sharing, so if pixmap doesn't change, all graphicsitems use the same pixmap.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        danilocesar
        wrote on last edited by
        #3

        It seems your goal is to have something as "QPixmapCache":http://doc.trolltech.com/4.6-snapshot/qpixmapcache.html, isn't it?

        <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
        Software Engineer

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved