Originally Posted by
ajoffe
Dziękuję serdecznie.
Proszę uprzejmie.
I understand that I need to make a copy of the pixmap, then paint the copy back into the original. But why are pointers bad in this case, and what do you mean by shared
Try something like this:
{
result.fill(Qt::transparent); // optionally
p.drawPixmap(dx, dy, thePixmap);
p.end();
return result;
}
QPixmap scrollGraphics(int dx, int dy, const QPixmap &thePixmap)
{
QPixmap result(thePixmap.size());
result.fill(Qt::transparent); // optionally
QPainter p(&result);
p.drawPixmap(dx, dy, thePixmap);
p.end();
return result;
}
To copy to clipboard, switch view to plain text mode
And read about "implicit sharing".
Bookmarks