diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-02 17:08:58 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-06-06 16:59:31 +0000 |
commit | b46cb00fc0e63dc0e58c6779b4e0f92e0cec70a7 (patch) | |
tree | bfe9f7b2e1659becb974ff051038562e909f7ad5 /src/widgets | |
parent | b72a9cbaaf7d49a1813c3b1926a68e05f47f350a (diff) |
Handle negative leading in layout
Adjust line positions to deal with negative leading which isn't included
in height of QTextLine.
Change-Id: Id7918968c0f9d7e65700b9e7a08fc5d761883f22
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index f654a12d34..8f295ce955 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -46,6 +46,7 @@ #include <qdebug.h> #include <qdrag.h> #include <qclipboard.h> +#include <qmath.h> #if QT_CONFIG(menu) #include <qmenu.h> #endif @@ -380,6 +381,8 @@ void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block) line.setLineWidth(availableWidth); line.setPosition(QPointF(margin, height)); height += line.height(); + if (line.leading() < 0) + height += qCeil(line.leading()); blockMaximumWidth = qMax(blockMaximumWidth, line.naturalTextWidth() + 2*margin); } tl->endLayout(); |