You can use pixmap as paint device:
class Class {
};
void Class::drawShip () {
QPainter back_painter
(this
->backbuffer
);
// drawing code
};
painter1.drawPixmap (0,0, this->backbuffer);
};
class Class {
QPixmap *backbuffer;
};
void Class::drawShip () {
QPainter back_painter (this->backbuffer);
// drawing code
};
void Class::paintEvent(QPaintEvent *event) {
QPainter painter1(this);
painter1.drawPixmap (0,0, this->backbuffer);
};
To copy to clipboard, switch view to plain text mode
Of course you need to initialize pixmap, and keep it at actual size(e.g. after resize events) and valid state (after ship rotated or moved).
Bookmarks