aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2016-09-29 16:23:46 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2016-09-29 16:23:46 (GMT)
commit5519b0ec5da7e78430f5deb6042195961af49e1c (patch)
treeefd107b1efdb81c26d1af3ce12501c2a162c8545
parenta99a1cc845e1db69f1b86601c0bde2a20c3b1936 (diff)
Fix KeyChar::value Handling
Properties of the type char a no longer exposed as integers to QML. Now they are strings. Adapt to that.
-rw-r--r--src/qml/KeyItem.qml2
-rw-r--r--src/qml/KeyLabel.qml17
-rw-r--r--src/qml/TrainingScreen.qml5
3 files changed, 7 insertions, 17 deletions
diff --git a/src/qml/KeyItem.qml b/src/qml/KeyItem.qml
index f538b4f..20c825f 100644
--- a/src/qml/KeyItem.qml
+++ b/src/qml/KeyItem.qml
@@ -47,7 +47,7 @@ Item {
switch (key.keyType()) {
case "key":
for (var i = 0; i < key.keyCharCount; i++) {
- if (key.keyChar(i).value == eventText.charCodeAt(0)) {
+ if (key.keyChar(i).value == eventText) {
return true;
}
}
diff --git a/src/qml/KeyLabel.qml b/src/qml/KeyLabel.qml
index 700b579..ed11262 100644
--- a/src/qml/KeyLabel.qml
+++ b/src/qml/KeyLabel.qml
@@ -49,28 +49,19 @@ Text {
if (position === keyChar.position) {
return keyChar
}
- else if (position === keyChar.position) {
- return keyChar
- }
- else if (position === keyChar.position) {
- return keyChar
- }
- else if (position === keyChar.position) {
- return keyChar
- }
}
return null;
}
function keyLabel(position, key) {
var keyChar = root.keyChar(position, key)
- return keyChar? String.fromCharCode(keyChar.value): ""
+ return keyChar? keyChar.value: ""
}
- color: key.state == "normal"? "#333": "#222"
+ color: key.state === "normal"? "#333": "#222"
smooth: true
font.pixelSize: referenceKey.height * Math.min(horizontalScaleFactor, verticalScaleFactor) / 3
- text: key.keyType() == "specialKey"?
- position == KeyChar.TopLeft? specialKeyLabel(key.type): "":
+ text: key.keyType() === "specialKey"?
+ position === KeyChar.TopLeft? specialKeyLabel(key.type): "":
keyLabel(position, key)
}
diff --git a/src/qml/TrainingScreen.qml b/src/qml/TrainingScreen.qml
index 19c80b4..3afebdc 100644
--- a/src/qml/TrainingScreen.qml
+++ b/src/qml/TrainingScreen.qml
@@ -56,7 +56,7 @@ FocusScope {
keyItems[i].enabled = false;
for (var j = 0; j < key.keyCharCount; j++) {
var keyChar = key.keyChar(j)
- if (chars.indexOf(String.fromCharCode(keyChar.value)) != -1) {
+ if (chars.indexOf(keyChar.value) != -1) {
keyItems[i].enabled = true;
if (keyChar.modifier !== "") {
usedModifiers[keyChar.modifier] = true
@@ -241,10 +241,9 @@ FocusScope {
key.isHighlighted = true
newHighlightedKeys.push(key)
if (typeof which == "string") {
- var code = which.charCodeAt(0)
for (var i = 0; i < key.key.keyCharCount; i++) {
var keyChar = key.key.keyChar(i)
- if (keyChar.value == code && keyChar.modifier != "") {
+ if (keyChar.value == which && keyChar.modifier != "") {
var modifier = findModifierKeyItem(keyChar.modifier)
if (modifier) {
modifier.isHighlighted = true