From ca5d6cccde1f977eedb46f3320fe8384ea41758e Mon Sep 17 00:00:00 2001 From: Wang Chuan Date: Mon, 5 Apr 2021 11:41:48 +0800 Subject: 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 (cherry picked from commit d98694c4023881673259ba040c10df7e71ec3d37) --- src/quick/items/qquicktextinput.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index aac7137ff3..56ce752987 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2954,6 +2954,7 @@ void QQuickTextInputPrivate::setTopPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->topPaddingChanged(); } } @@ -2968,6 +2969,7 @@ void QQuickTextInputPrivate::setLeftPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->leftPaddingChanged(); } } @@ -2982,6 +2984,7 @@ void QQuickTextInputPrivate::setRightPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->rightPaddingChanged(); } } @@ -2996,6 +2999,7 @@ void QQuickTextInputPrivate::setBottomPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->bottomPaddingChanged(); } } @@ -4705,6 +4709,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(); -- cgit v1.2.3