summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2019-11-22 19:44:48 +0100
committerAndré de la Rocha <andre.rocha@qt.io>2019-11-25 18:02:41 +0100
commitb8cf3c35002affe9f1876dd3940d75171be43f64 (patch)
tree225374e3394b19b5c520e6860fef039ccf087668 /src
parent770a1d71560f7195fed0ada523884784bc89f791 (diff)
Windows QPA: Disable the native Windows OSK if Qt Virtual Keyboard is in use
This change detects that the Qt Virtual Keyboard is in use through the QT_IM_MODULE environment variable and disables the native Windows OSK accordingly, to avoid showing both virtual keyboards at the same time. Task-number: QTBUG-76088 Change-Id: I2715b337e6de729f0514ea1892b94b3c4f9cd984 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp7
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp12
2 files changed, 16 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 079c25f9eb..19d632dc10 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -283,8 +283,11 @@ void QWindowsInputContext::showInputPanel()
// 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.
- if (QOperatingSystemVersion::current() >=
- QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) {
+ // Only trigger the native OSK if the Qt OSK is not in use.
+ static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE");
+ if (imModuleEmpty
+ && QOperatingSystemVersion::current()
+ >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) {
ShowCaret(platformWindow->handle());
} else {
HideCaret(platformWindow->handle());
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index f589fd6b10..e5a9f275ae 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -390,7 +390,17 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR
setVariantI4(UIA_WindowControlTypeId, pRetVal);
} else {
// Control type converted from role.
- setVariantI4(roleToControlTypeId(accessible->role()), pRetVal);
+ auto controlType = roleToControlTypeId(accessible->role());
+
+ // The native OSK should be disbled if the Qt OSK is in use.
+ static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE");
+
+ // If we want to disable the native OSK auto-showing
+ // we have to report text fields as non-editable.
+ if (controlType == UIA_EditControlTypeId && !imModuleEmpty)
+ controlType = UIA_TextControlTypeId;
+
+ setVariantI4(controlType, pRetVal);
}
break;
case UIA_HelpTextPropertyId: