Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QPainter::restore (  )  [inherited]

Restores the current painter state (pops a saved state off the stack).

See also:
save()

Definition at line 1180 of file qpainter.cpp.

References QPainter::isActive().

Referenced by QTextLayout::draw(), QTextLine::draw(), Q3SimpleRichText::draw(), QGraphicsScene::drawBackground(), QWindowsVistaStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QTextDocument::drawContents(), Q3IconView::drawContents(), QSplashScreen::drawContents(), Q3ListView::drawContentsOffset(), QCDEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QWindowsXPStyle::drawControl(), QCommonStyle::drawControl(), QItemDelegate::drawDisplay(), QGraphicsScene::drawForeground(), QPainter::drawImage(), QGraphicsScene::drawItems(), QPainter::drawPicture(), QPainter::drawPixmap(), QPainter::drawPoints(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QTreeView::drawRow(), QPaintEngine::drawTextItem(), QPainter::drawTiledPixmap(), QPicture::exec(), Q3ComboTableItem::paint(), QGraphicsTextItem::paint(), QItemDelegate::paint(), Q3ListBox::paintCell(), Q3Table::paintCell(), Q3Frame::paintEvent(), QHeaderView::paintEvent(), QListView::paintEvent(), QLabel::paintEvent(), Q3ComboBox::paintEvent(), QGraphicsView::paintEvent(), Q3IconViewItem::paintItem(), Q3Header::paintSection(), QGraphicsView::render(), QGraphicsScene::render(), Q3SimpleRichText::setWidth(), and Q3ListBox::viewportPaintEvent().

{
#ifdef QT_DEBUG_DRAW
    if (qt_show_painter_debug_output)
        printf("QPainter::restore()\n");
#endif
    Q_D(QPainter);
    if (d->states.size()<=1) {
        qWarning("QPainter::restore: Unbalanced save/restore");
        return;
    } else if (!isActive()) {
        qWarning("QPainter::restore: Painter not active");
        return;
    }

    QPainterState *tmp = d->state;
    d->states.pop_back();
    d->state = d->states.back();
    d->txinv = false;

    // trigger clip update if the clip path/region has changed since
    // last save
    if (!d->state->clipInfo.isEmpty()
        && (tmp->changeFlags & (QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipPath))) {
        // reuse the tmp state to avoid any extra allocs...
        tmp->dirtyFlags = QPaintEngine::DirtyClipPath;
        tmp->clipOperation = Qt::NoClip;
        tmp->clipPath = QPainterPath();
        d->engine->updateState(*tmp);
        // replay the list of clip states,
        for (int i=0; i<d->state->clipInfo.size(); ++i) {
            const QPainterClipInfo &info = d->state->clipInfo.at(i);
            tmp->matrix.setMatrix(info.matrix.m11(), info.matrix.m12(), info.matrix.m13(),
                                  info.matrix.m21(), info.matrix.m22(), info.matrix.m23(),
                                  info.matrix.dx() - d->redirection_offset.x(),
                                  info.matrix.dy() - d->redirection_offset.y(), info.matrix.m33());
            tmp->clipOperation = info.operation;
            if (info.clipType == QPainterClipInfo::RegionClip) {
                tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform;
                tmp->clipRegion = info.region;
            } else { // clipType == QPainterClipInfo::PathClip
                tmp->dirtyFlags = QPaintEngine::DirtyClipPath | QPaintEngine::DirtyTransform;
                tmp->clipPath = info.path;
            }
            d->engine->updateState(*tmp);
        }


        //Since we've updated the clip region anyway, pretend that the clip path hasn't changed:
        d->state->dirtyFlags &= ~(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion);
        tmp->changeFlags &= ~(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion);
        tmp->changeFlags |= QPaintEngine::DirtyTransform;
    }

    d->updateState(d->state);
    delete tmp;
}


Generated by  Doxygen 1.6.0   Back to index