summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocumentlayout.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-25 01:00:16 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-25 01:00:16 +0200
commit375efdd0e157a80de08627612e36597a22c6ac06 (patch)
tree493209a04e60a8ccc9c2e551637db8cec1c92f0a /src/gui/text/qtextdocumentlayout.cpp
parent9ae0fa4d4977ef1eb28eff2f95b429e9455ba748 (diff)
parent5edf34848a51c7678031aeb9576b8f3b7b5fceab (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/gui/text/qtextdocumentlayout.cpp')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 7be114adf97..ed23a4d8d9f 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -2088,8 +2088,12 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain
tl->draw(painter, offset, selections, context.clip.isValid() ? (context.clip & clipRect) : clipRect);
- if ((context.cursorPosition >= blpos && context.cursorPosition < blpos + bllen)
- || (context.cursorPosition < -1 && !tl->preeditAreaText().isEmpty())) {
+ // if the block is empty and it precedes a table, do not draw the cursor.
+ // the cursor is drawn later after the table has been drawn so no need
+ // to draw it here.
+ if (!isEmptyBlockBeforeTable(frameIteratorForTextPosition(blpos))
+ && ((context.cursorPosition >= blpos && context.cursorPosition < blpos + bllen)
+ || (context.cursorPosition < -1 && !tl->preeditAreaText().isEmpty()))) {
int cpos = context.cursorPosition;
if (cpos < -1)
cpos = tl->preeditAreaPosition() - (cpos + 2);