summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsinputcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsinputcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index d5258ca6a3..f1f5d3a96e 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -280,13 +280,19 @@ void QWindowsInputContext::showInputPanel()
// with Windows 10 if the Windows IME is (re)enabled _after_ the caret is shown.
if (m_caretCreated) {
cursorRectChanged();
- // We only call ShowCaret() on Windows 10 as in earlier versions the caret
- // would actually be visible (QTBUG-74492) and the workaround for the
- // Surface seems unnecessary there anyway. But leave it hidden for IME.
- if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10)
+ // We only call ShowCaret() on Windows 10 after 1703 as in earlier versions
+ // the caret would actually be visible (QTBUG-74492) and the workaround for
+ // the Surface seems unnecessary there anyway. But leave it hidden for IME.
+ // Only trigger the native OSK if the Qt OSK is not in use.
+ static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE");
+ bool nativeVKDisabled = QCoreApplication::testAttribute(Qt::AA_MSWindowsDisableVirtualKeyboard);
+ if ((imModuleEmpty && !nativeVKDisabled)
+ && QOperatingSystemVersion::current()
+ >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) {
ShowCaret(platformWindow->handle());
- else
+ } else {
HideCaret(platformWindow->handle());
+ }
setWindowsImeEnabled(platformWindow, false);
setWindowsImeEnabled(platformWindow, true);
}