diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-11-09 10:04:54 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-12-03 10:42:00 +0000 |
commit | 416b4cf685030114837bd375664fd12047895a62 (patch) | |
tree | 595cd2fc4411bbf7e0fd9f23361c6a553bf5f700 /src/gui | |
parent | 5dde7bd92211c4049b75738b17532f6d6a66b37c (diff) |
Set correct vertical position for text following a very large image
If the document is paged and contains an image spanning more than one
page, correctly set the y position for everything following that
image.
Change-Id: I1c584c7a907c1728c2965f1dc3fdc56069ab3172
Fixes: QTBUG-59886
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ebd7a7d69f..323253c70d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -155,7 +155,7 @@ struct QTextLayoutStruct { { return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); } inline void newPage() - { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY; } + { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = qMax(y, pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY); } }; class QTextTableData : public QTextFrameData @@ -2709,7 +2709,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1; getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight, &lineBottom); - if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && + while (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && layoutStruct->pageHeight >= lineBreakHeight) { layoutStruct->newPage(); |