From 021a8ce5f767d2fdeb72cebc6d6e8bb08b87f24d Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 16 Nov 2020 08:59:05 +0100 Subject: [PATCH] Give QWidget::updateMicroFocus a parameter with default This allows for potential optimizations in widgets, e.g. no need to for the input method to query all data when only the cursor position changed. Change-Id: Idd1e554acd776ed4d225197ce80915d651ede904 Reviewed-by: Lars Knoll --- src/widgets/kernel/qwidget.cpp | 8 ++++---- src/widgets/kernel/qwidget.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5890ee4702e..4cc24499fc4 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -11473,13 +11473,13 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable) #endif // QT_NO_SHORTCUT /*! - Updates the widget's micro focus. + Updates the widget's micro focus and informs input methods + that the state specified by \a query has changed. */ -void QWidget::updateMicroFocus() +void QWidget::updateMicroFocus(Qt::InputMethodQuery query) { - // updating everything since this is currently called for any kind of state change if (this == QGuiApplication::focusObject()) - QGuiApplication::inputMethod()->update(Qt::ImQueryAll); + QGuiApplication::inputMethod()->update(query); } /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index b423b0ebad2..14608a5f13e 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -667,7 +667,7 @@ public: void setInputMethodHints(Qt::InputMethodHints hints); protected Q_SLOTS: - void updateMicroFocus(); + void updateMicroFocus(Qt::InputMethodQuery query = Qt::ImQueryAll); protected: void create(WId = 0, bool initializeWindow = true,