Commit 04a3e74f authored by Jarkko Koivikko's avatar Jarkko Koivikko
Browse files

Optimized QML related to shift state handling


Remove unnecessary QML bindings to optimize performance.

Task-number: QTBUG-57082
Change-Id: Ibda52c5ddcc564a7b92dbd7831afd885c344718d
Reviewed-by: default avatarMitch Curtis <mitch.curtis@qt.io>
Showing with 7 additions and 7 deletions
......@@ -36,7 +36,6 @@ Item {
property alias listView: listView
property int keyCode
property point origin
property bool uppercased: keyboard.uppercased
signal clicked
z: 1
......@@ -86,7 +85,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)
}
}
......@@ -95,7 +94,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()
......
......@@ -29,6 +29,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.VirtualKeyboard 2.1
/*!
\qmltype BaseKey
......@@ -203,7 +204,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.
......
......@@ -28,6 +28,7 @@
****************************************************************************/
import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
Item {
property bool active
......@@ -44,7 +45,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)
......
......@@ -59,7 +59,6 @@ Item {
return "main"
}
property bool active: Qt.inputMethod.visible
property bool uppercased: InputContext.shift
property bool handwritingMode
property bool fullScreenHandwritingMode
property bool symbolMode
......@@ -635,7 +634,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()
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment