Commit 8ce9006f authored by Jarkko Koivikko's avatar Jarkko Koivikko
Browse files

Use uppercase property


Since we now have InputCase.uppercase property, use it instead of
InputContext.shift where appropriate.

By using the uppercase property, we ensure any future modification
to ShiftHandler does not break uppercase handling.

The uppercase property is true when either shift or capsLock properties
are true.

Change-Id: I5bdd4431f66619ac944f70273a0a89ba4c750026
Reviewed-by: default avatarMitch Curtis <mitch.curtis@qt.io>
Showing with 5 additions and 5 deletions
......@@ -85,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,
InputContext.shift ? Qt.ShiftModifier : 0)
InputContext.uppercase ? Qt.ShiftModifier : 0)
}
}
......@@ -94,7 +94,7 @@ Item {
var alternativeKeys = key.effectiveAlternativeKeys
if (alternativeKeys.length > 0) {
for (var i = 0; i < alternativeKeys.length; i++) {
listModel.append({ "text": InputContext.shift ? alternativeKeys[i].toUpperCase() : alternativeKeys[i] })
listModel.append({ "text": InputContext.uppercase ? alternativeKeys[i].toUpperCase() : alternativeKeys[i] })
}
listView.width = keyboard.style.alternateKeysListItemWidth * listModel.count
listView.forceLayout()
......
......@@ -204,7 +204,7 @@ Item {
By default, this property reflects the uppercase status of the keyboard.
*/
property bool uppercased: InputContext.shift && !noModifier
property bool uppercased: InputContext.uppercase && !noModifier
/*! Sets the key panel delegate for the key.
......
......@@ -45,7 +45,7 @@ Item {
onActiveKeyChanged: {
if (activeKey && characterPreview.item !== null) {
characterPreview.item.text = InputContext.shift ? activeKey.text.toUpperCase() : activeKey.text
characterPreview.item.text = InputContext.uppercase ? activeKey.text.toUpperCase() : activeKey.text
width = activeKey.width
height = activeKey.height
var position = keyboard.mapFromItem(activeKey, 0, 0)
......
......@@ -634,7 +634,7 @@ Item {
function click(key) {
if (key && key.enabled) {
if (!key.noKeyEvent)
InputContext.inputEngine.virtualKeyClick(key.key, InputContext.shift ? key.text.toUpperCase() : key.text, InputContext.shift ? Qt.ShiftModifier : 0)
InputContext.inputEngine.virtualKeyClick(key.key, InputContext.uppercase ? key.text.toUpperCase() : key.text, InputContext.uppercase ? 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