QPixmap ImageS, ImageD;bool repaintS, repaintD;void PaintS(QPainter *painter) {/*...*/}void PaintD(QPainter *painter) {/*...*/}void paintEvent(QPaintEvent *){ QPainter *painter; painter = new QPainter(this); PaintAll(painter); delete painter;}void PaintAll(QPainter *painter){ if (repaintS) { repaintS = false; ImageS = QPixmap(W, H); ImageS.fill(Qt::transparent); QPainter painterS(&ImageS); PaintS(&painterS); } if (repaintD) { repaintD = false; ImageD = QPixmap(W, H); ImageD.fill(Qt::transparent); QPainter painterD(&ImageD); PaintD(&painterD); } painter->drawPixmap(X, Y, ImageS); painter->drawPixmap(X, Y, ImageD);}
QPalette pal = palette();pal.setBrush(QPalette::Window, QBrush(ImageS));setPalette(pal);
QLabel *LabelBackGround;LabelBackGround->setPixmap(ImageS);
//painter->drawPixmap(X, Y, ImageS);
ImageD = ImageS;//painter->drawPixmap(X, Y, ImageS);//painter->drawPixmap(X, Y, ImageD);
if (repaintD) { repaintD = false; ImageD = QPixmap(W, H); ImageD.fill(Qt::transparent); QPainter painterD(&ImageD); PaintD(&painterD); } painter->drawPixmap(X, Y, ImageS); painter->drawPixmap(X, Y, ImageD);
if (repaintD) { repaintD = false; ImageD = ImageS; QPainter painterD(&ImageD); PaintD(&painterD); } //painter->drawPixmap(X, Y, ImageS); painter->drawPixmap(X, Y, ImageD);