C

Qt Quick Ultralite freertos_app_switch Example

/****************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
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.centerIn: parent font.pixelSize: 30 horizontalAlignment : Text.AlignHCenter text: "Application #1 (Qt for MCUs)" } Text { anchors.centerIn: parent 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(); } } } } } }