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.
void QPainter::drawRects(const QRectF *rects, int rectCount)
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:
if(this->device()->devType() == QInternal::Pixmap) {
const QPixmap *Pixmap = dynamic_cast<const QPixmap *>(this->device());
qDebug() << "rect2pixmap - address: "<<Pixmap<<" - key: "<<Pixmap.cacheKey();
}
I tried finding the memory address of the Qpixmap and checking it against the memory addresses of the QPixmaps being written to the screen.
void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
{
const QWidget *widget = dynamic_cast<const QWidget *>(this->device());
qDebug() << "pixmap - address: "<<&pm << " - key: "<<pm.cacheKey();
[...]
But the addresses are all different. I also tried using cachekeys, but I faced the same problem.
Here's a sample console output:
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
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?
If anything isn't clear abut the question, please tell me, and I'll try to clarify as best as I can.
Thank you.