diff options
Diffstat (limited to 'src/gui/kernel/qplatforminputcontext.cpp')
-rw-r--r-- | src/gui/kernel/qplatforminputcontext.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp index b8a53685e5..9d3ee4acb6 100644 --- a/src/gui/kernel/qplatforminputcontext.cpp +++ b/src/gui/kernel/qplatforminputcontext.cpp @@ -47,6 +47,11 @@ QT_BEGIN_NAMESPACE QPlatformInputContext::QPlatformInputContext() : QObject(*(new QPlatformInputContextPrivate)) { + // Delay initialization of cached input direction + // until super class has finished constructing. + QMetaObject::invokeMethod(this, [this]{ + m_inputDirection = inputDirection(); + }, Qt::QueuedConnection); } /*! @@ -95,7 +100,7 @@ void QPlatformInputContext::update(Qt::InputMethodQueries) } /*! - Called when when the word currently being composed in input item is tapped by + Called when the word currently being composed in the input item is tapped by the user. Input methods often use this information to offer more word suggestions to the user. */ @@ -192,22 +197,29 @@ void QPlatformInputContext::emitInputPanelVisibleChanged() QLocale QPlatformInputContext::locale() const { - return qt_keymapper_private()->keyboardInputLocale; + return QLocale::system(); } void QPlatformInputContext::emitLocaleChanged() { emit QGuiApplication::inputMethod()->localeChanged(); + + // Changing the locale might have updated the input direction + emitInputDirectionChanged(inputDirection()); } Qt::LayoutDirection QPlatformInputContext::inputDirection() const { - return qt_keymapper_private()->keyboardInputDirection; + return locale().textDirection(); } void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection) { + if (newDirection == m_inputDirection) + return; + emit QGuiApplication::inputMethod()->inputDirectionChanged(newDirection); + m_inputDirection = newDirection; } /*! |