title: Connecting QPixmaps with the data being drawn on them
body: <p>I am looking for a way to connect the QPixmap and the data being written on it, so that in the end I can have an accurate record of what is currently on the screen.</p>
  
  <pre><code>void QPainter::drawRects(const QRectF *rects, int rectCount)
  </code></pre>
  
  <p>This is an example function from qpainter.cpp (found in ./src/gui/painting in the Qt SDK)
  What I am trying to get is the Pixmap that the rectangle is being written to (in the case when device()->devType() is a Pixmap). So I have this check:</p>
  
  <pre><code>if(this-&gt;device()-&gt;devType() == QInternal::Pixmap) {
      const QPixmap *Pixmap = dynamic_cast&lt;const QPixmap *&gt;(this-&gt;device());
      qDebug() &lt;&lt; "rect2pixmap - address: "&lt;&lt;Pixmap&lt;&lt;" - key: "&lt;&lt;Pixmap.cacheKey();
  }
  </code></pre>
  
  <p>I tried finding the memory address of the Qpixmap and checking it against the memory addresses of the QPixmaps being written to the screen.</p>
  
  <pre><code>void QPainter::drawPixmap(const QPointF &amp;p, const QPixmap &amp;pm)
  {
      const QWidget *widget = dynamic_cast&lt;const QWidget *&gt;(this-&gt;device());
      qDebug() &lt;&lt; "pixmap - address: "&lt;&lt;&amp;pm &lt;&lt; " - key: "&lt;&lt;pm.cacheKey();
      [...]
  </code></pre>
  
  <p>But the addresses are all different. I also tried using cachekeys, but I faced the same problem.</p>
  
  <p>Here's a sample console output:</p>
  
  <pre><code>rect2pixmap - address:  0x7fffac1dc9c0  - key: 72057594037927937
  rect2pixmap - address:  0x7fffac1d9f80  - key: 72057598332895233 
  rect2pixmap - address:  0x7fffac1dcd60  - key: 72057602627862529
  rect2pixmap - address:  0x7fffac1dcd60  - key: 72057606922829825
  rect2pixmap - address:  0x7fffac1dd100  - key: 72057611217797121
  rect2pixmap - address:  0x7fffac1df2e0  - key: 72057615512764417 
  pixmap - address:  0x7fffac1dffa0  - key:  197568495616 
  pixmap - address:  0x7fffac1e0170  - key:  214748364800 
  pixmap - address:  0x7fffac1e0340  - key:  231928233984 
  pixmap - address:  0x7fffac1e0510  - key:  249108103168 
  pixmap - address:  0x7fffac1e06e0  - key:  261993005056
  rect2pixmap - address:  0x7fffac1dadb0   - key: 72057619807731713 
  </code></pre>
  
  <p>So what I am asking is there anyway to link between the pixmap that the rect is being written to and the pixmap that is being printed later on to the screen? 
  And can I safely assume that the rects aren't being shown on the screen if no Pixmaps are ever called?</p>
  
  <p>If anything isn't clear abut the question, please tell me, and I'll try to clarify as best as I can.</p>
  
  <p>Thank you.</p>