From f2fd3807c32e5f1f4921e0324f2e584c912d0ad6 Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Wed, 23 Sep 2020 13:50:59 +0800 Subject: Always update the input method when QLineEdit receives focus The line edit receiving focus might require different input method capabilities (e.g. be a password edit), so the input method needs to be refreshed when focus is received. This implicitly happens on tab focus when the text is selected or the cursor is moved within an input mask, but neither of those might happen, and for click-focus it never happened. Fixes: QTBUG-86846 Done-with: Volker Hilsheimer Change-Id: I47c5275d3a9d4d190ebce64269a345431346c17c Reviewed-by: Volker Hilsheimer (cherry picked from commit d5e8efd8cb02876dc314da0579d33af39ba38495) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/widgets/qlineedit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 35569d6eeb..c45df84dcf 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1905,8 +1905,11 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->control->moveCursor(d->control->nextMaskBlank(0)); else if (!d->control->hasSelectedText()) selectAll(); + else + updateMicroFocus(); } else if (e->reason() == Qt::MouseFocusReason) { d->clickCausedFocus = 1; + updateMicroFocus(); } #ifdef QT_KEYPAD_NAVIGATION if (!QApplicationPrivate::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason))) { -- cgit v1.2.3