style💄: 更新页面内容

feat: 添加其他页面,但是没有添加功能
file📦: 添加APP图标
This commit is contained in:
Alvin Young 2024-11-28 19:11:59 +08:00
parent 8ef0a05b73
commit 2fdeecfb0a
12 changed files with 113 additions and 27 deletions

View File

@ -20,11 +20,16 @@ qt_add_qml_module(appESP32_upper
VERSION 1.0 VERSION 1.0
QML_FILES QML_FILES
Main.qml Main.qml
QML/pages/HomePage.qml QML/pages/MainPage.qml
QML_FILES QML/models/TestModels.qml QML_FILES QML/models/TestModels.qml
QML_FILES QML/components/LeftMenu.qml QML_FILES QML/components/LeftMenu.qml
QML_FILES QML/models/GlobalProperties.qml QML_FILES QML/models/GlobalProperties.qml
RESOURCES resources.qrc 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. # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.

View File

@ -6,12 +6,12 @@ Window {
width: 1300 width: 1300
height: 750 height: 750
visible: true visible: true
title: qsTr("Hello World") title: qsTr("ESP32上位机")
minimumHeight: 600 minimumHeight: 600
minimumWidth: 800 minimumWidth: 800
// color: "green" // color: "green"
HomePage { MainPage {
id: id_home_page id: id_home_page
} }
} }

View File

@ -27,6 +27,7 @@ Item {
global_properties.left_menu_index_last = global_properties.left_menu_index_now global_properties.left_menu_index_last = global_properties.left_menu_index_now
global_properties.left_menu_index_now = index global_properties.left_menu_index_now = index
id_view.currentIndex = index id_view.currentIndex = index
id_layout_right_panel.currentIndex = index
// console.log("left_menu_index", global_properties.left_menu_index_now) // console.log("left_menu_index", global_properties.left_menu_index_now)
} }

12
QML/pages/CmdPage.qml Normal file
View File

@ -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"
}
}

View File

@ -1,30 +1,12 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Layouts
import ESP32_upper 1.0
Item { Item {
id: root Text {
anchors.centerIn: parent
RowLayout { id: id_lm_tooltip_text
spacing: 0 text: "Home Page"
font.pixelSize: 20
Rectangle { color: "#0e0606"
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"
}
} }
} }

47
QML/pages/MainPage.qml Normal file
View File

@ -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 {
}
}
}
}
}

12
QML/pages/OTAPage.qml Normal file
View File

@ -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"
}
}

12
QML/pages/PlotPage.qml Normal file
View File

@ -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"
}
}

12
QML/pages/SerialPage.qml Normal file
View File

@ -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"
}
}

BIN
assets/img/esp32_upper.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,10 +1,12 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QIcon>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/assets/img/esp32_upper.png")); // 设置应用窗口图标
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
QObject::connect( QObject::connect(
&engine, &engine,

View File

@ -6,5 +6,6 @@
<file>assets/img/home-3-fill.svg</file> <file>assets/img/home-3-fill.svg</file>
<file>assets/img/terminal-box-fill.svg</file> <file>assets/img/terminal-box-fill.svg</file>
<file>assets/img/line-chart-fill.svg</file> <file>assets/img/line-chart-fill.svg</file>
<file>assets/img/esp32_upper.png</file>
</qresource> </qresource>
</RCC> </RCC>