diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-03-02 17:20:53 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-03-03 12:38:21 +0100 |
commit | 95be4f1e3945f88adc9d55fa06371665254a1127 (patch) | |
tree | 3739dba70ca65db8afd8efebd23cc572e712dc97 /src/virtualkeyboard/content/InputPanel.qml | |
parent | 4e8b3dd45ae4cc66a1b77cce901f80406b2a0f69 (diff) |
Refactor desktop-detection logic to become an explicit propertyv5.15.0-beta2
The __isRootPanel internal property was used to detect whether the
keyboard is running in as a stand-alone, toplevel window in the desktop.
The value of the property depended on the location of the keyboard panel
within the QQuickItem hierarchy, which is fragile.
Instead, declare an explicit property desktopPanel that is set to true
by the desktop integration when the panel has been created.
Change-Id: Idb9e90e01e9b1c643e84287716e0b964256b115e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/virtualkeyboard/content/InputPanel.qml')
-rw-r--r-- | src/virtualkeyboard/content/InputPanel.qml | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index ea3ab23f..f511eab2 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -114,16 +114,13 @@ Item { property alias keyboard: keyboard /*! \internal */ - readonly property bool __isRootItem: inputPanel.parent != null && inputPanel.parent.parent == null - - /*! \internal */ - property bool __reparented: false + property bool desktopPanel: false SelectionControl { objectName: "selectionControl" x: -parent.x y: -parent.y - enabled: active && !keyboard.fullScreenMode && (!__isRootItem || __reparented) + enabled: active && !keyboard.fullScreenMode && !desktopPanel } implicitHeight: keyboard.height @@ -143,8 +140,8 @@ Item { target: InputContext.priv property: "keyboardRectangle" value: mapToItem(null, - __isRootItem ? keyboard.x : x, - (__isRootItem ? keyboard.y : y) + keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0), + desktopPanel ? keyboard.x : x, + (desktopPanel ? keyboard.y : y) + keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0), keyboard.width, keyboard.height - keyboard.wordCandidateView.currentYOffset + (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0)) when: !InputContext.animating |