Skip to content

2 bigger backports to qtvirtualkeyboard

Skimmed through issues list for possibly relevant backports. Only 2nd patch required conflict resolution as documented in git summary.

[PATCH 1/2] Fix activation of input panel when initial active focus is set

Never change m_visible state internally. Instead, m_visible is merely
a parameter which affects to actual visible state.

The m_visible state should correspond to latest showInputPanel() or
hideInputPanel() call. The actual visible state is evaluated in the
evaluateInputPanelVisible() method, which factors in other parameters,
such as input focus and Qt::ImEnabled.

Speaking of Qt::ImEnabled, this change also optimizes out one input
method query during frequently called update() method by using
QPlatformInputContext::inputMethodAccepted() instead.

[ChangeLog] It is now possible to open the input panel implicitly when
activating the window. Before, this failed because the "visible" state
was reset (due to a bug) during activation.

Fixes: QTBUG-86190
Pick-to: 5.15
Change-Id: I31b73f8a29c5e51de60836ea1ccab70547bad0a0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
(cherry picked from commit 90d64dea7d0370abcb5b787bcc77dc4770f491ed)

[PATCH 2/2] Only reparent the InputPanel when necessary

The input panel needs to work also while a modal popup is open. Since
the concept of modality does not exist in Qt Quick, and is implemented
with an event-eating overlay, 4e8b3dd45ae4cc66a1b77cce901f80406b2a0f69
introduced the automatic reparenting of the integrated input panel so
that it a sibling of the overlay, with a higher z-value.

This effectively changed the parent item, and had negative side effects
to mechanisms such as anchoring.

This change only reparents the input panel if there is an overlay (using
the mechanism also used by the Qt Quick Control class QQuickOverlay)
that is visible when the input item changes, and sets the z-value to be
one above the overlay's. The prevents modal blocking during the overlay
session. When the input item changes again and the overlay is no longer
visible, then the parent and z value get reset.

This improves the situation, but is still not ideal, as during modal
sessions the anchoring of the input panel will still not work as
expected.

Add a test case that verifies that clicks go through to the keyboard
while a modal dialog is open.

Fixes: QTBUG-97075
Task-number: QTBUG-56918
Task-number: QTBUG-92881
Pick-to: 6.2 5.15
Change-Id: I7a5bcfebe7b69780234737a2311e08b2a6f60a4e
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
(cherry picked from commit 5564f1c96322d7c3f884d2e6f9b3a95e3134fb9f)

asturmlechner 2022-01-19: Resolved conflict with dev branch commit
  916bf3025355653e16a4df209d4e08ec385a4f57 and get rid of tests not
  wired up in qmake with git rm -f tests/auto/inputpanel

Only 2 backports left after 5.15.3 rebase.

Edited by Andreas Sturmlechner

Merge request reports