diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2016-11-12 14:38:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-01-30 15:18:15 +0000 |
commit | c683d8fd4d2d0b5f61014c1840d148a2d8faaac4 (patch) | |
tree | c6c916f38d79026072797c51cb6ffded668756a0 | |
parent | ea873857fd7c92608bfa64d080dbdf9589ffa4b3 (diff) |
Optimized QML related to shift state handling
Remove unnecessary QML bindings to optimize performance.
Task-number: QTBUG-57082
Change-Id: Ibda52c5ddcc564a7b92dbd7831afd885c344718d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 04a3e74fd2a568db62c7d5eeaab497d02eb73759)
4 files changed, 7 insertions, 7 deletions
diff --git a/src/virtualkeyboard/content/components/AlternativeKeys.qml b/src/virtualkeyboard/content/components/AlternativeKeys.qml index 59a26935..de846aae 100644 --- a/src/virtualkeyboard/content/components/AlternativeKeys.qml +++ b/src/virtualkeyboard/content/components/AlternativeKeys.qml @@ -28,7 +28,6 @@ Item { property alias listView: listView property int keyCode property point origin - property bool uppercased: keyboard.uppercased signal clicked z: 1 @@ -78,7 +77,7 @@ Item { if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) { var activeKey = listView.model.get(listView.currentIndex) InputContext.inputEngine.virtualKeyClick(keyCode, activeKey.text, - uppercased ? Qt.ShiftModifier : 0) + InputContext.shift ? Qt.ShiftModifier : 0) } } @@ -87,7 +86,7 @@ Item { var alternativeKeys = key.effectiveAlternativeKeys if (alternativeKeys.length > 0) { for (var i = 0; i < alternativeKeys.length; i++) { - listModel.append({ "text": uppercased ? alternativeKeys[i].toUpperCase() : alternativeKeys[i] }) + listModel.append({ "text": InputContext.shift ? alternativeKeys[i].toUpperCase() : alternativeKeys[i] }) } listView.width = keyboard.style.alternateKeysListItemWidth * listModel.count listView.forceLayout() diff --git a/src/virtualkeyboard/content/components/BaseKey.qml b/src/virtualkeyboard/content/components/BaseKey.qml index df06c374..4a352ab2 100644 --- a/src/virtualkeyboard/content/components/BaseKey.qml +++ b/src/virtualkeyboard/content/components/BaseKey.qml @@ -21,6 +21,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 +import QtQuick.Enterprise.VirtualKeyboard 2.0 /*! \qmltype BaseKey @@ -201,7 +202,7 @@ Item { By default, this property reflects the uppercase status of the keyboard. */ - property bool uppercased: keyboard.uppercased && !noModifier + property bool uppercased: InputContext.shift && !noModifier /*! Sets the key panel delegate for the key. diff --git a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml b/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml index 28549381..aaa31c79 100644 --- a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml +++ b/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml @@ -20,6 +20,7 @@ ******************************************************************************/ import QtQuick 2.0 +import QtQuick.Enterprise.VirtualKeyboard 2.0 Item { property bool active @@ -36,7 +37,7 @@ Item { onActiveKeyChanged: { if (activeKey && characterPreview.item !== null) { - characterPreview.item.text = keyboard.uppercased ? activeKey.text.toUpperCase() : activeKey.text + characterPreview.item.text = InputContext.shift ? activeKey.text.toUpperCase() : activeKey.text width = activeKey.width height = activeKey.height var position = keyboard.mapFromItem(activeKey, 0, 0) diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml index 29eed63b..b8b7d19a 100644 --- a/src/virtualkeyboard/content/components/Keyboard.qml +++ b/src/virtualkeyboard/content/components/Keyboard.qml @@ -51,7 +51,6 @@ Item { return "main" } property bool active: Qt.inputMethod.visible - property bool uppercased: InputContext.shift property bool handwritingMode property bool fullScreenHandwritingMode property bool symbolMode @@ -627,7 +626,7 @@ Item { function click(key) { if (key && key.enabled) { if (!key.noKeyEvent) - InputContext.inputEngine.virtualKeyClick(key.key, keyboard.uppercased ? key.text.toUpperCase() : key.text, keyboard.uppercased ? Qt.ShiftModifier : 0) + InputContext.inputEngine.virtualKeyClick(key.key, InputContext.shift ? key.text.toUpperCase() : key.text, InputContext.shift ? Qt.ShiftModifier : 0) key.clicked() } } |