aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2023-04-17 10:53:32 +0200
committerDavid Schulz <david.schulz@qt.io>2023-04-18 12:52:41 +0000
commitaa0c9bc741091f2212955bc3f9dc7d20116c6f9c (patch)
tree78a6658fd886d73cb0ed6e5bb0af3ee855165988
parentf3166144500427ccc528e35686361350d576dfbf (diff)
Editor: skip painting selection path out of clip rect
Change-Id: Ieec7afbec729708884c24d8de2b4a6c488220a69 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/texteditor/texteditoroverlay.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp
index 4a6eda6c2c..52ab8709de 100644
--- a/src/plugins/texteditor/texteditoroverlay.cpp
+++ b/src/plugins/texteditor/texteditoroverlay.cpp
@@ -252,6 +252,8 @@ void TextEditorOverlay::paintSelection(QPainter *painter,
return;
QPainterPath path = createSelectionPath(begin, end, clip);
+ if (path.isEmpty())
+ return;
painter->save();
QColor penColor = fg;
@@ -307,6 +309,8 @@ void TextEditorOverlay::fillSelection(QPainter *painter,
return;
QPainterPath path = createSelectionPath(begin, end, clip);
+ if (path.isEmpty())
+ return;
painter->save();
painter->translate(-.5, -.5);