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 1536 of file qpainter.cpp.

References QTransform::dx(), QTransform::dy(), QTransform::m11(), QTransform::m12(), QTransform::m13(), QTransform::m21(), QTransform::m22(), QTransform::m23(), QTransform::m33(), and QTransform::setMatrix().

Referenced by QTextLayout::draw(), QTextLine::draw(), Q3SimpleRichText::draw(), SvgView::drawBackground(), QWindowsXPStylePrivate::drawBackground(), QGraphicsScene::drawBackground(), Bubble::drawBubble(), QTableViewPrivate::drawCell(), QWindowsVistaStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), ArthurStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QTextDocument::drawContents(), Q3IconView::drawContents(), QSplashScreen::drawContents(), Q3ListView::drawContentsOffset(), QCDEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsVistaStyle::drawControl(), QGtkStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsCEStyle::drawControl(), QMotifStyle::drawControl(), QWindowsMobileStyle::drawControl(), QWindowsStyle::drawControl(), QWindowsXPStyle::drawControl(), QCommonStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDisplay(), QGraphicsScene::drawForeground(), QPainter::drawImage(), CustomScene::drawItems(), QGraphicsScene::drawItems(), DemoScene::drawItems(), QPainter::drawPicture(), QPainter::drawPixmap(), QPainter::drawPoints(), QPaintEngine::drawPoints(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QWindowsCEStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), NorwegianWoodStyle::drawPrimitive(), ArthurStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QTreeView::drawRow(), QtPropertyEditorView::drawRow(), QPainter::drawTiledPixmap(), QPicture::exec(), Context2D::fillRect(), BasicToolsPlugin::mouseMove(), StarRating::paint(), Helper::paint(), Chip::paint(), Car::paint(), DisplayWidget::paint(), Q3ComboTableItem::paint(), QFontFamilyDelegate::paint(), QGraphicsTextItem::paint(), QtPropertyEditorDelegate::paint(), QItemDelegate::paint(), QT_BEGIN_NAMESPACE::PageItem::paint(), PixelDelegate::paint(), Q3ListBox::paintCell(), Q3Table::paintCell(), QCommandLinkButton::paintEvent(), Q3Frame::paintEvent(), ShapedClock::paintEvent(), ColorDock::paintEvent(), WorldTimeClock::paintEvent(), Q3TableHeader::paintEvent(), ArthurFrame::paintEvent(), QHeaderView::paintEvent(), AnalogClock::paintEvent(), QtGradientWidget::paintEvent(), MandelbrotWidget::paintEvent(), QListView::paintEvent(), QLabel::paintEvent(), QPixelTool::paintEvent(), QtGradientStopsWidget::paintEvent(), Q3ComboBox::paintEvent(), QGraphicsView::paintEvent(), Q3IconViewItem::paintItem(), Q3Header::paintSection(), QGraphicsWidget::paintWindowFrame(), QGraphicsView::render(), QWebFrame::render(), QGraphicsScene::render(), Q3SVGPaintEnginePrivate::restoreAttributes(), Q3SimpleRichText::setWidth(), Context2D::strokeRect(), 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 (!d->engine) {
        qWarning("QPainter::restore: Painter not active");
        return;
    }

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

    if (d->extended) {
        d->checkEmulation();
        d->extended->setState(d->state);
        delete tmp;
        return;
    }

    // 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->state->redirection_offset.x(),
                                  info.matrix.dy() - d->state->redirection_offset.y(), info.matrix.m33());
            tmp->clipOperation = info.operation;
            if (info.clipType == QPainterClipInfo::RectClip) {
                tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform;
                tmp->clipRegion = info.rect;
            } else 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;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index