diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-22 22:28:32 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-22 22:28:33 +0200 |
commit | c0f7cc3a3cc3f06b09591f25277f8083b3a55581 (patch) | |
tree | ecf3d3f49d6dc85b55fbdbe999e386ceda31ef39 /examples/widgets/widgets/codeeditor/codeeditor.cpp | |
parent | 139240ac671953f0763308f235d8b868c1efe1b1 (diff) | |
parent | aa6d7dd7ee306c0adbcd42b013d1e749072205bb (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ic274a375d6fc1312ced2354e034dc0980dd47c51
Diffstat (limited to 'examples/widgets/widgets/codeeditor/codeeditor.cpp')
-rw-r--r-- | examples/widgets/widgets/codeeditor/codeeditor.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/widgets/widgets/codeeditor/codeeditor.cpp b/examples/widgets/widgets/codeeditor/codeeditor.cpp index 8e29860669..e93a0251e5 100644 --- a/examples/widgets/widgets/codeeditor/codeeditor.cpp +++ b/examples/widgets/widgets/codeeditor/codeeditor.cpp @@ -48,10 +48,11 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "codeeditor.h" +#include <QPainter> +#include <QTextBlock> + //![constructor] CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) @@ -157,8 +158,8 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) //![extraAreaPaintEvent_1] QTextBlock block = firstVisibleBlock(); int blockNumber = block.blockNumber(); - int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + (int) blockBoundingRect(block).height(); + int top = qRound(blockBoundingGeometry(block).translated(contentOffset()).top()); + int bottom = top + qRound(blockBoundingRect(block).height()); //![extraAreaPaintEvent_1] //![extraAreaPaintEvent_2] @@ -172,7 +173,7 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) block = block.next(); top = bottom; - bottom = top + (int) blockBoundingRect(block).height(); + bottom = top + qRound(blockBoundingRect(block).height()); ++blockNumber; } } |