diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2022-02-16 11:17:37 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2022-03-30 06:42:58 +0200 |
commit | 54f9fde2fe06d816142125a04dc2c3b5ac471aae (patch) | |
tree | 5bf78060981ae080304e01a24d4db7e00fe9eb04 | |
parent | 822bb9c78d6ed92630c7d59200054767066f8196 (diff) |
Use proper type (instead of var) for Keyboard.activeKey
Virtual Keyboard was not impacted by this bug until it started using
qmlcachegen with combined qmlmodule.
The bug triggered with following property and code:
property var activeKey
...
activeKey = functionThatReturnsAnItem()
...
if (activeKey) {
// Unreachable code
}
The reason is that qmlcachegen incorrectly handled implicit type cast.
This issue does not impact on any of the previous released qt versions,
since none of them were using qmlcachegen for virtual keyboard
components. This is because the components were embedded in the
resources of the virtual keyboard qt module (QtXVirtualKeyboard).
The preferred workaround in this case is to use an explicit type
instead of variant. This will eliminate the implicit type cast.
Task-number: QTBUG-100883
Change-Id: I4fea27df2d1242f6bdb38a4f4fddd44a8d5902fc
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/virtualkeyboard/content/components/CharacterPreviewBubble.qml | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/content/components/Keyboard.qml | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml b/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml index 776600af..ad0cef5a 100644 --- a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml +++ b/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml @@ -32,7 +32,7 @@ import QtQuick.VirtualKeyboard Item { property bool active - property var activeKey: keyboard.activeKey + property Item activeKey: keyboard.activeKey visible: active && activeKey !== undefined && activeKey !== null && activeKey.showPreview z: 1 diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml index 9f0c2be3..56015d77 100644 --- a/src/virtualkeyboard/content/components/Keyboard.qml +++ b/src/virtualkeyboard/content/components/Keyboard.qml @@ -45,7 +45,7 @@ Item { property alias style: styleLoader.item property alias wordCandidateView: wordCandidateView property alias shadowInputControl: shadowInputControl - property var activeKey: null + property Item activeKey: null property TouchPoint activeTouchPoint property int localeIndex: -1 property var availableLocaleIndices: [] @@ -912,7 +912,7 @@ Item { id: keyboardInputArea objectName: "keyboardInputArea" - property var initialKey: null + property Item initialKey: null property bool dragSymbolMode property real releaseMargin: initialKey !== null ? Math.min(initialKey.width / 3, initialKey.height / 3) : 0 property point navigationCursor: Qt.point(-1, -1) |