diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-05-02 15:29:59 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-05-05 20:19:15 +0000 |
commit | 3744a52580a80d85891d393929ae24241a6cb49f (patch) | |
tree | 2442391592b541304ef6b1220f962f8b5c43d7c4 /src/quicktemplates2/qquicktextarea.cpp | |
parent | c64d32423dfcaa5dab3c5b5c5f9891aeb1c8e0bc (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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quicktemplates2/qquicktextarea.cpp')
-rw-r--r-- | src/quicktemplates2/qquicktextarea.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 259cabf1f7..3176fa50d2 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -1019,7 +1019,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(); |