Skip to content

Commit

Permalink
add key(enter/right/left) input count
Browse files Browse the repository at this point in the history
  • Loading branch information
moguriso committed Jun 20, 2016
1 parent 7e25f73 commit bf7476f
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions main.qml
Expand Up @@ -8,23 +8,34 @@ Window {
id: main_form
}

Item {
property int tap_count: 0
anchors.fill: parent
focus: true
Keys.onEnterPressed: {
console.log("Enter key")
tap_count++;
main_form.tap_count_txt.text = tap_count
}

Keys.onLeftPressed: {
console.log("move left")
}

Keys.onRightPressed: {
console.log("move right")
}
}

MouseArea {
property int click_count: 0
id: mouseArea1
anchors.fill: parent
focus:true

onClicked: {
click_count++;
main_form.click_count_txt.text = click_count
}

Keys.onEnterPressed: {
//event.accepted = true;
if (event.key == Qt.Key_Enter) {
event.accepted = true;
tab_count++
main_form.tap_count_txt.text = tap_count
}
}
}
}

0 comments on commit bf7476f

Please sign in to comment.