diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2021-04-05 11:41:48 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-16 23:15:30 +0000 |
commit | 9d426d0f0352808d04d8e97f97cea668e3f0bba4 (patch) | |
tree | f4c4352be9be3d1df8fb8d66a93c91681154bdac /src | |
parent | 52c6fd1437df56cc167d208bafb85c1096bfc1cb (diff) |
QQuickTextInput: update cursor rectangle after padding changed
The position of cursor delegate needs to be updated when we change
padding, otherwise it will be in a wrong position.
Fixes: QTBUG-91867
Change-Id: I89ca84fe893ebf517ab67890196eede14a4055d7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d98694c4023881673259ba040c10df7e71ec3d37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 8d33b68413..e0adac786b 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2955,6 +2955,7 @@ void QQuickTextInputPrivate::setTopPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->topPaddingChanged(); } } @@ -2969,6 +2970,7 @@ void QQuickTextInputPrivate::setLeftPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->leftPaddingChanged(); } } @@ -2983,6 +2985,7 @@ void QQuickTextInputPrivate::setRightPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->rightPaddingChanged(); } } @@ -2997,6 +3000,7 @@ void QQuickTextInputPrivate::setBottomPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->bottomPaddingChanged(); } } @@ -4735,6 +4739,7 @@ void QQuickTextInput::setPadding(qreal padding) d->extra.value().padding = padding; d->updateLayout(); + updateCursorRectangle(); emit paddingChanged(); if (!d->extra.isAllocated() || !d->extra->explicitTopPadding) emit topPaddingChanged(); |