diff --git a/CMakeLists.txt b/CMakeLists.txt index c82b39d..07b4a05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,11 +20,16 @@ qt_add_qml_module(appESP32_upper VERSION 1.0 QML_FILES Main.qml - QML/pages/HomePage.qml + QML/pages/MainPage.qml QML_FILES QML/models/TestModels.qml QML_FILES QML/components/LeftMenu.qml QML_FILES QML/models/GlobalProperties.qml RESOURCES resources.qrc + QML_FILES QML/pages/HomePage.qml + QML_FILES QML/pages/SerialPage.qml + QML_FILES QML/pages/CmdPage.qml + QML_FILES QML/pages/PlotPage.qml + QML_FILES QML/pages/OTAPage.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. diff --git a/Main.qml b/Main.qml index 0e34504..a36f189 100644 --- a/Main.qml +++ b/Main.qml @@ -6,12 +6,12 @@ Window { width: 1300 height: 750 visible: true - title: qsTr("Hello World") + title: qsTr("ESP32上位机") minimumHeight: 600 minimumWidth: 800 // color: "green" - HomePage { + MainPage { id: id_home_page } } diff --git a/QML/components/LeftMenu.qml b/QML/components/LeftMenu.qml index cf26ef9..c5ba362 100644 --- a/QML/components/LeftMenu.qml +++ b/QML/components/LeftMenu.qml @@ -27,6 +27,7 @@ Item { global_properties.left_menu_index_last = global_properties.left_menu_index_now global_properties.left_menu_index_now = index id_view.currentIndex = index + id_layout_right_panel.currentIndex = index // console.log("left_menu_index", global_properties.left_menu_index_now) } diff --git a/QML/pages/CmdPage.qml b/QML/pages/CmdPage.qml new file mode 100644 index 0000000..600b8d7 --- /dev/null +++ b/QML/pages/CmdPage.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + Text { + anchors.centerIn: parent + id: id_lm_tooltip_text + text: "Cmd Page" + font.pixelSize: 20 + color: "#0e0606" + } + +} diff --git a/QML/pages/HomePage.qml b/QML/pages/HomePage.qml index 5851dcc..9f1a7d6 100644 --- a/QML/pages/HomePage.qml +++ b/QML/pages/HomePage.qml @@ -1,30 +1,12 @@ import QtQuick 2.15 -import QtQuick.Controls -import QtQuick.Layouts -import ESP32_upper 1.0 Item { - id: root - - RowLayout { - spacing: 0 - - Rectangle { - id: id_left_panel - width: 80 - height: Window.height - color: "#00FF00" - - LeftMenu { - anchors.fill: parent - } - } - - Rectangle { - width: Window.width - id_left_panel.width - height: Window.height - color: "#0000FF" - } + Text { + anchors.centerIn: parent + id: id_lm_tooltip_text + text: "Home Page" + font.pixelSize: 20 + color: "#0e0606" } } diff --git a/QML/pages/MainPage.qml b/QML/pages/MainPage.qml new file mode 100644 index 0000000..73dd5aa --- /dev/null +++ b/QML/pages/MainPage.qml @@ -0,0 +1,47 @@ +import QtQuick 2.15 +import QtQuick.Controls +import QtQuick.Layouts +import ESP32_upper 1.0 + +Item { + id: root + + RowLayout { + spacing: 0 + + Rectangle { + id: id_left_panel + width: 80 + height: Window.height + color: "#00FF00" + + LeftMenu { + anchors.fill: parent + } + } + + Rectangle { + width: Window.width - id_left_panel.width + height: Window.height + color: "#0000FF" + + StackLayout{ + id: id_layout_right_panel + currentIndex: 0 + anchors.fill: parent + + HomePage { + } + SerialPage { + } + CmdPage { + } + PlotPage { + } + OTAPage { + } + } + } + } + +} diff --git a/QML/pages/OTAPage.qml b/QML/pages/OTAPage.qml new file mode 100644 index 0000000..b35a673 --- /dev/null +++ b/QML/pages/OTAPage.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + Text { + anchors.centerIn: parent + id: id_lm_tooltip_text + text: "OTA Page" + font.pixelSize: 20 + color: "#0e0606" + } + +} diff --git a/QML/pages/PlotPage.qml b/QML/pages/PlotPage.qml new file mode 100644 index 0000000..14e6743 --- /dev/null +++ b/QML/pages/PlotPage.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + Text { + anchors.centerIn: parent + id: id_lm_tooltip_text + text: "Plot Page" + font.pixelSize: 20 + color: "#0e0606" + } + +} diff --git a/QML/pages/SerialPage.qml b/QML/pages/SerialPage.qml new file mode 100644 index 0000000..d31f2bb --- /dev/null +++ b/QML/pages/SerialPage.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + Text { + anchors.centerIn: parent + id: id_lm_tooltip_text + text: "Serial Page" + font.pixelSize: 20 + color: "#0e0606" + } + +} diff --git a/assets/img/esp32_upper.png b/assets/img/esp32_upper.png new file mode 100644 index 0000000..50ed472 Binary files /dev/null and b/assets/img/esp32_upper.png differ diff --git a/main.cpp b/main.cpp index c5c0efb..9cd2425 100644 --- a/main.cpp +++ b/main.cpp @@ -1,10 +1,12 @@ #include #include +#include int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); + app.setWindowIcon(QIcon(":/assets/img/esp32_upper.png")); // 设置应用窗口图标 QQmlApplicationEngine engine; QObject::connect( &engine, diff --git a/resources.qrc b/resources.qrc index e5c8ec0..6681bd6 100644 --- a/resources.qrc +++ b/resources.qrc @@ -6,5 +6,6 @@ assets/img/home-3-fill.svg assets/img/terminal-box-fill.svg assets/img/line-chart-fill.svg + assets/img/esp32_upper.png