Files
sonobulus/ui/Main.qml
2026-06-13 22:04:27 -05:00

74 lines
1.6 KiB
QML

import QtQuick
import QtQuick.Controls
import AppDemo
ApplicationWindow {
visible: true
width: 1200
height: 800
title: "sonobulus"
TimerComponent {
id: timerComponent
}
Column {
anchors.centerIn: parent
spacing: 20
Label {
text: timerComponent.seconds + " s"
font.pixelSize: 32
horizontalAlignment: Text.AlignHCenter
}
Button {
text: "Reset"
onClicked: timerComponent.reset()
}
}
Item {
anchors.fill: parent
focus: true
Keys.onPressed: (event) => {
if(!event.isAutoRepeat) {
keyboardController.keyDownEvent(event.key, event.modifiers, event.text)
event.accepted = true
}
}
Keys.onReleased: (event) => {
if(!event.isAutoRepeat) {
keyboardController.keyUpEvent(event.key, event.modifiers, event.text)
event.accepted = true
}
}
}
Scope {
id: scope
width: 600
height: 300
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -200
// this timer triggers a constant update on the scope's canvas, calls its draw() each time
Timer {
id: updateTimer
interval: 16 // ~60 fps
running: true
repeat: true
onTriggered: scope.update()
}
buffer: scopeBuffer
}
}