Skip to content

Instantly share code, notes, and snippets.

@MagneFire
Created February 7, 2026 19:38
Show Gist options
  • Select an option

  • Save MagneFire/16adf13c2ac11f0182d2dda7656fc901 to your computer and use it in GitHub Desktop.

Select an option

Save MagneFire/16adf13c2ac11f0182d2dda7656fc901 to your computer and use it in GitHub Desktop.
Simple AsteroidOS button tester
import QtQuick 2.0
import org.asteroid.controls 1.0
import org.asteroid.utils 1.0
Item {
property string key: "42"
id: root
anchors.fill: parent
focus: true
Text {
anchors.centerIn: parent
text: root.key
}
Keys.onPressed: (event)=> {
console.log(event.key)
root.key = event.key
if (event.key == Qt.Key_MenuKB) console.log("MenuKB")
if (event.key == Qt.Key_VolumeUp) console.log("Volume Up")
if (event.key == Qt.Key_VolumeDown) console.log("Volume Down")
if (event.key == Qt.Key_Left) {
console.log("move left");
event.accepted = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment