C
Qt Quick Ultralite freertos_app_switch Example
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick 2.15
import QtQuick.Controls 2.15
Rectangle {
id: root
Column {
Rectangle {
color: "#41CD52"
width: root.width
height: Math.round(root.height * 0.77)
Column {
anchors.centerIn: parent
Text {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 30
horizontalAlignment : Text.AlignHCenter
text: "Application #1 (Qt for MCUs)"
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 16
horizontalAlignment : Text.AlignHCenter
text: "Choose the application (#1 or #2)\nto run at next boot then press the Reset button"
}
}
}
Row {
Rectangle {
color: "#8C8C8C"
width: Math.round(root.width * 0.6)
height: Math.round(root.height * 0.23)
Row {
anchors.centerIn: parent
RadioButton {
id: app1Button
checked: true
text: "App #1"
onCheckedChanged: {
if (checked) {
app2Button.checked = false
DevControl.application = 1
}
}
}
RadioButton {
id: app2Button
checked: false
text: "App #2"
onCheckedChanged: {
if (checked) {
app1Button.checked = false
DevControl.application = 2
}
}
}
}
}
Rectangle {
color: "#FF0000"
width: Math.round(root.width * 0.4)
height: Math.round(root.height * 0.23)
Button {
id: resetButton
text: "Reset!"
anchors.centerIn: parent
onClicked: {
console.log("Chosen application #", DevControl.application, "...Resetting system!")
DevControl.resetDevice();
}
}
}
}
}
}