Handle keyboard in QML
This commit is contained in:
@@ -4,11 +4,22 @@ import QtQuick.Layouts 1.3
|
||||
import Magnum 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
id: app
|
||||
visible: true
|
||||
width: 640
|
||||
height: 480
|
||||
title: qsTr("My Application")
|
||||
|
||||
Shortcut {
|
||||
sequence: "q"
|
||||
onActivated: app.close()
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "l"
|
||||
onActivated: lagging.checked = !lagging.checked
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
@@ -81,11 +92,19 @@ ApplicationWindow {
|
||||
Layout.preferredWidth: parent.width
|
||||
|
||||
CheckBox {
|
||||
text: "Lagging"
|
||||
id: lagging
|
||||
text: "Lagging (L)"
|
||||
onCheckStateChanged: {
|
||||
if (checked)
|
||||
magnum.lagging = 0.85
|
||||
else
|
||||
magnum.lagging = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Magnum {
|
||||
id: magnum
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
Reference in New Issue
Block a user