if(backInvalidate){
backImage.fill(qRgba(0,0,0,0));
imagePainter.
setRenderHint(QPainter::Antialiasing);
createBackground(&imagePainter);
backInvalidate = false;
}
if(foreInvalidate){
foregroundImage
= QImage(QSize(width
(), height
()),
QImage::Format_ARGB32_Premultiplied);
foregroundImage.fill(qRgba(0,0,0,0));
QPainter imagePainter
(&foregroundImage
);
imagePainter.
setRenderHint(QPainter::Antialiasing);
createForeground(&imagePainter);
foreinvalidate = false;
}
mainPainter
->setRenderHint
(QPainter::Antialiasing);
mainPainter->resetTransform();
mainPainter->drawImage(0, 0, foregroundImage);
mainPainter->drawImage(0, 0, backImage);
paintTargets(mainPainter);
drawHand(mainPainter);
delete mainPainter;
}
void RadarCircle::paintEvent(QPaintEvent *){
if(backInvalidate){
backImage = QImage(QSize(width(), height()), QImage::Format_ARGB32_Premultiplied);
backImage.fill(qRgba(0,0,0,0));
QPainter imagePainter(&backImage);
imagePainter.setRenderHint(QPainter::Antialiasing);
createBackground(&imagePainter);
backInvalidate = false;
}
if(foreInvalidate){
foregroundImage = QImage(QSize(width(), height()), QImage::Format_ARGB32_Premultiplied);
foregroundImage.fill(qRgba(0,0,0,0));
QPainter imagePainter(&foregroundImage);
imagePainter.setRenderHint(QPainter::Antialiasing);
createForeground(&imagePainter);
foreinvalidate = false;
}
QPainter* mainPainter = new QPainter(this);
mainPainter->setRenderHint(QPainter::Antialiasing);
mainPainter->resetTransform();
mainPainter->drawImage(0, 0, foregroundImage);
mainPainter->drawImage(0, 0, backImage);
paintTargets(mainPainter);
drawHand(mainPainter);
delete mainPainter;
}
To copy to clipboard, switch view to plain text mode
Bookmarks