aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-02 15:29:59 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-06 09:49:49 +0000
commit591cf585a3d4c4297f4900553aba612ebd062a04 (patch)
tree56da2b7914b0c06acd1bc8259815162c758b0f26
parentc6ad9c30c894e97cdb60eaf319826e52616dc3cc (diff)
TextArea: make clip node wider to accommodate cursor when right-aligned
TextArea { horizontalAlignment:TextEdit.AlignRight } draws its cursor past the right edge of the text itself. 1 px seems to be enough. Fixes: QTBUG-84280 Change-Id: I7aa58249f97c7f25a7caf3adc01e1a46917508c9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d75ab891ed37d67f1614fe0f19a1e506bb564970) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 860eb768..124d285c 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -1086,7 +1086,11 @@ QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
if (d->flickable)
clipper = d->flickable;
- const QRectF cr = clipper->clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding());
+ const QRectF cr = clipper->clipRect().adjusted(
+ leftPadding(), topPadding(),
+ (!d->cursorItem && effectiveHAlign() == HAlignment::AlignRight ? 1 : 0) - rightPadding(),
+ -bottomPadding());
+
clipNode->setRect(!d->flickable ? cr : cr.translated(d->flickable->contentX(), d->flickable->contentY()));
clipNode->update();