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>bb10
parent
770a1d7156
commit
b8cf3c3500
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue