|
@@ -2,6 +2,9 @@
|
|
#include "ui_mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "jobs.h"
|
|
#include "jobs.h"
|
|
#include <QDebug>
|
|
#include <QDebug>
|
|
|
|
+#include <QWidget>
|
|
|
|
+#include <QPushButton>
|
|
|
|
+
|
|
// 定义 ANzI 转义序列来设置颜色
|
|
// 定义 ANzI 转义序列来设置颜色
|
|
#define ANSI_COLOR_GREEN "\x1B[32m"
|
|
#define ANSI_COLOR_GREEN "\x1B[32m"
|
|
#define ANSI_COLOR_RESET "\x1B[0m"
|
|
#define ANSI_COLOR_RESET "\x1B[0m"
|
|
@@ -13,8 +16,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|
// 去除窗口边界,设置为无边框窗口
|
|
// 去除窗口边界,设置为无边框窗口
|
|
this->setWindowFlags(Qt::FramelessWindowHint);
|
|
this->setWindowFlags(Qt::FramelessWindowHint);
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
- this->setWindowFlags(Qt::FramelessWindowHint); //Makes the frame invisible
|
|
|
|
this->setWindowState(Qt::WindowMaximized); //Maximizes the window
|
|
this->setWindowState(Qt::WindowMaximized); //Maximizes the window
|
|
|
|
+
|
|
|
|
+ ui->setupUi(this);
|
|
initializeAnimate();
|
|
initializeAnimate();
|
|
// initialMqttService();
|
|
// initialMqttService();
|
|
|
|
|
|
@@ -40,6 +44,20 @@ MainWindow::MainWindow(QWidget *parent)
|
|
ui->labLat->setText("经度: "+lat);
|
|
ui->labLat->setText("经度: "+lat);
|
|
ui->labLon->setText("维度: "+lon);
|
|
ui->labLon->setText("维度: "+lon);
|
|
connect(ui->btnClose, &QPushButton::clicked, this, &MainWindow::close);
|
|
connect(ui->btnClose, &QPushButton::clicked, this, &MainWindow::close);
|
|
|
|
+ connect(this, &MainWindow::projectTitleChanged, this, &MainWindow::updateProjectTitleLabel);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::updateProjectTitleLabel(const QString &newTitle) {
|
|
|
|
+ ui->projectTitleLable->setText(newTitle);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::setProjectTitle(const QString &newTitle) {
|
|
|
|
+ if (m_currentProjectTitle != newTitle) {
|
|
|
|
+ m_currentProjectTitle = newTitle;
|
|
|
|
+ qDebug() << "Project title changed to:" << m_currentProjectTitle;
|
|
|
|
+ // Emit the signal to notify listeners (like our QLabel slot)
|
|
|
|
+ emit projectTitleChanged(m_currentProjectTitle);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::initializeAnimate() {
|
|
void MainWindow::initializeAnimate() {
|
|
@@ -83,6 +101,7 @@ void MainWindow::switchPage(QWidget *button) {
|
|
buttonToPage.remove(button);
|
|
buttonToPage.remove(button);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
QWidget* newPage = factory->createPage(this);
|
|
QWidget* newPage = factory->createPage(this);
|
|
ui->stackedWidget->addWidget(newPage);
|
|
ui->stackedWidget->addWidget(newPage);
|
|
ui->stackedWidget->setCurrentWidget(newPage);
|
|
ui->stackedWidget->setCurrentWidget(newPage);
|
|
@@ -90,6 +109,7 @@ void MainWindow::switchPage(QWidget *button) {
|
|
buttonToPage.insert(button, newPage);
|
|
buttonToPage.insert(button, newPage);
|
|
int pageCount = ui->stackedWidget->count();
|
|
int pageCount = ui->stackedWidget->count();
|
|
|
|
|
|
|
|
+ setProjectTitle(qobject_cast<QPushButton*>(button)->text());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -208,4 +228,3 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
|
|
event->accept();
|
|
event->accept();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|