C
Qt Quick Ultralite interrupt_handler Example
// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial import QtQuick 2.15 Rectangle { id: root color: "white" Text { text: "Press the board's user button to\nstop and resume the rectangle" anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top } Rectangle { id: rect anchors.verticalCenter: parent.verticalCenter width: 50; height: 50 color: "black" } Timer { id: timer interval: 10 running: true repeat: true onTriggered: { rect.x = ((rect.x + rect.width + 5) % (root.width + rect.width)) - rect.width } } MouseArea { id: ta anchors.fill: parent onPressedChanged: { root.color = pressed ? "yellow" : "white" } } HWButtonInput.onButtonEvent: { timer.running = !timer.running } }