diff options
author | Trond Kjernaasen <trond@trolltech.com> | 2009-02-27 13:42:49 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2009-05-12 09:03:05 (GMT) |
commit | 4c5841f7f4414729872445da6fdec13597b5902b (patch) | |
tree | ba8165ed94c9510aceff3be892c6740b5007cd64 /src | |
parent | 453abe70fec02456aba2219025f5202060eaece1 (diff) | |
download | Qt-4c5841f7f4414729872445da6fdec13597b5902b.zip Qt-4c5841f7f4414729872445da6fdec13597b5902b.tar.gz Qt-4c5841f7f4414729872445da6fdec13597b5902b.tar.bz2 |
Draw the shadow before the page background to avoid antialiasing overlaps
when the paper is drawn.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qprintpreviewwidget.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 16334b8..d4e5122 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -98,29 +98,8 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QRectF paperRect(0,0, paperSize.width(), paperSize.height()); - painter->setClipRect(paperRect & option->exposedRect); - painter->fillRect(paperRect, Qt::white); - if (!pagePicture) - return; - painter->drawPicture(pageRect.topLeft(), *pagePicture); - - // Effect: make anything drawn in the margins look washed out. - QPainterPath path; - path.addRect(paperRect); - path.addRect(pageRect); - painter->setPen(QPen(Qt::NoPen)); - painter->setBrush(QColor(255, 255, 255, 180)); - painter->drawPath(path); - - painter->setClipRect(option->exposedRect); -#if 0 - // Draw frame around paper. - painter->setPen(QPen(Qt::black, 0)); - painter->setBrush(Qt::NoBrush); - painter->drawRect(paperRect); -#endif - // Draw shadow + painter->setClipRect(option->exposedRect); qreal shWidth = paperRect.width()/100; QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), paperRect.bottomRight() + QPointF(shWidth, 0)); @@ -141,6 +120,27 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, cgrad.setColorAt(1.0, QColor(0,0,0,0)); painter->fillRect(cshadow, QBrush(cgrad)); + painter->setClipRect(paperRect & option->exposedRect); + painter->fillRect(paperRect, Qt::white); + if (!pagePicture) + return; + painter->drawPicture(pageRect.topLeft(), *pagePicture); + + // Effect: make anything drawn in the margins look washed out. + QPainterPath path; + path.addRect(paperRect); + path.addRect(pageRect); + painter->setPen(QPen(Qt::NoPen)); + painter->setBrush(QColor(255, 255, 255, 180)); + painter->drawPath(path); + +#if 0 + // Draw frame around paper. + painter->setPen(QPen(Qt::black, 0)); + painter->setBrush(Qt::NoBrush); + painter->drawRect(paperRect); +#endif + // todo: drawtext "Page N" below paper } |