diff options
author | Trond Kjernåsen <trond@trolltech.com> | 2009-06-11 09:48:38 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2009-06-11 09:51:23 (GMT) |
commit | 7f30a96c2b444d4350aab8c76f129eb57b3bd6a5 (patch) | |
tree | a1928f5686b684bc6c1398d23d4f987e03ff3b6b /src/gui/text | |
parent | 96e370f5dd18c54c5afd5cbb8a3c141c4c3cbae3 (diff) | |
download | Qt-7f30a96c2b444d4350aab8c76f129eb57b3bd6a5.zip Qt-7f30a96c2b444d4350aab8c76f129eb57b3bd6a5.tar.gz Qt-7f30a96c2b444d4350aab8c76f129eb57b3bd6a5.tar.bz2 |
Fixed a problem with disappearing borders in a QTextFrame.
The border was always drawn before the background, and if there were
both a border and background brush set, the background ended up
being drawn ontop of the border.
Task-number: 255868
Reviewed-by: Samuel
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index c66d0c1..3019e60 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -855,6 +855,24 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec void QTextDocumentLayoutPrivate::drawFrameDecoration(QPainter *painter, QTextFrame *frame, QTextFrameData *fd, const QRectF &clip, const QRectF &rect) const { + + const QBrush bg = frame->frameFormat().background(); + if (bg != Qt::NoBrush) { + QRectF bgRect = rect; + bgRect.adjust((fd->leftMargin + fd->border).toReal(), + (fd->topMargin + fd->border).toReal(), + - (fd->rightMargin + fd->border).toReal(), + - (fd->bottomMargin + fd->border).toReal()); + + QRectF gradientRect; // invalid makes it default to bgRect + QPointF origin = bgRect.topLeft(); + if (!frame->parentFrame()) { + bgRect = clip; + gradientRect.setWidth(painter->device()->width()); + gradientRect.setHeight(painter->device()->height()); + } + fillBackground(painter, bgRect, bg, origin, gradientRect); + } if (fd->border != 0) { painter->save(); painter->setBrush(Qt::lightGray); @@ -875,24 +893,6 @@ void QTextDocumentLayoutPrivate::drawFrameDecoration(QPainter *painter, QTextFra painter->restore(); } - - const QBrush bg = frame->frameFormat().background(); - if (bg != Qt::NoBrush) { - QRectF bgRect = rect; - bgRect.adjust((fd->leftMargin + fd->border).toReal(), - (fd->topMargin + fd->border).toReal(), - - (fd->rightMargin + fd->border).toReal(), - - (fd->bottomMargin + fd->border).toReal()); - - QRectF gradientRect; // invalid makes it default to bgRect - QPointF origin = bgRect.topLeft(); - if (!frame->parentFrame()) { - bgRect = clip; - gradientRect.setWidth(painter->device()->width()); - gradientRect.setHeight(painter->device()->height()); - } - fillBackground(painter, bgRect, bg, origin, gradientRect); - } } static void adjustContextSelectionsForCell(QAbstractTextDocumentLayout::PaintContext &cell_context, |