You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
8.3 KiB
C++
225 lines
8.3 KiB
C++
#include <QtCore/QVariant>
|
|
#include <QtGui/QIcon>
|
|
#include <QtWidgets/QApplication>
|
|
#include <QtWidgets/QHBoxLayout>
|
|
#include <QtWidgets/QMainWindow>
|
|
#include <QtWidgets/QPushButton>
|
|
#include <QtWidgets/QSpacerItem>
|
|
#include <QtWidgets/QStackedWidget>
|
|
#include <QtWidgets/QVBoxLayout>
|
|
#include <QtWidgets/QWidget>
|
|
#include <QtWidgets/QSplitter>
|
|
|
|
#include "./MonitorUI/MonitorUI.h"
|
|
#include "./AnalyticUI/ClearanceAnalyticUI.h"
|
|
#include "./AnalyticUI/FlangeAnalyticUI.h"
|
|
#include "./AnalyticUI/GyroscopeAnalyticUI.h"
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
|
|
class MainWindow:public QMainWindow
|
|
{
|
|
public:
|
|
QWidget *centralwidget;
|
|
QVBoxLayout *verticalLayout;
|
|
QWidget *titleWidget;
|
|
QHBoxLayout *horizontalLayout;
|
|
QSpacerItem *horizontalSpacer;
|
|
QPushButton *minButton;
|
|
QPushButton *closeButton;
|
|
QHBoxLayout *tabLayout;
|
|
QPushButton *monitorButton;
|
|
QPushButton *flangeButton;
|
|
QPushButton *clearanceButton;
|
|
QPushButton *gyroscopeButton;
|
|
QStackedWidget *stackedWidget;
|
|
MonitorWidget* monitorPage;
|
|
ClearanceAnalyticWidget *clearancePage;
|
|
FlangeAnalyticWidget* flangePage;
|
|
GyroscopeAnalyticWidget *gyroscopePage;
|
|
QTimer *curTimer;
|
|
|
|
|
|
|
|
|
|
void setupUi(QMainWindow *MainWindow)
|
|
{
|
|
if (MainWindow->objectName().isEmpty())
|
|
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
|
MainWindow->resize(1920, 1080);
|
|
|
|
centralwidget = new QWidget(MainWindow);
|
|
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
|
|
verticalLayout = new QVBoxLayout(centralwidget);
|
|
verticalLayout->setSpacing(0);
|
|
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
|
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
|
titleWidget = new QWidget(centralwidget);
|
|
titleWidget->setObjectName(QString::fromUtf8("titleWidget"));
|
|
horizontalLayout = new QHBoxLayout(titleWidget);
|
|
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
|
horizontalLayout->setContentsMargins(0, 0, 10, 20);
|
|
horizontalLayout->setSpacing(5);
|
|
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
|
|
horizontalLayout->addItem(horizontalSpacer);
|
|
|
|
minButton = new QPushButton(titleWidget);
|
|
minButton->setObjectName(QString::fromUtf8("minButton"));
|
|
QIcon icon;
|
|
icon.addFile(QString::fromUtf8(":/Static/min.png"), QSize(), QIcon::Normal, QIcon::On);
|
|
minButton->setIcon(icon);
|
|
|
|
horizontalLayout->addWidget(minButton);
|
|
|
|
closeButton = new QPushButton(titleWidget);
|
|
closeButton->setObjectName(QString::fromUtf8("closeButton"));
|
|
QIcon icon1;
|
|
icon1.addFile(QString::fromUtf8(":/Static/close.png"), QSize(), QIcon::Normal, QIcon::On);
|
|
closeButton->setIcon(icon1);
|
|
|
|
horizontalLayout->addWidget(closeButton);
|
|
|
|
|
|
verticalLayout->addWidget(titleWidget);
|
|
|
|
tabLayout = new QHBoxLayout();
|
|
tabLayout->setObjectName(QString::fromUtf8("tabLayout"));
|
|
|
|
tabLayout->setContentsMargins(20, 0, 20, 20);
|
|
tabLayout->addStretch();
|
|
|
|
monitorButton = new QPushButton(centralwidget);
|
|
monitorButton->setObjectName(QString::fromUtf8("monitorButton"));
|
|
|
|
|
|
tabLayout->addWidget(monitorButton);
|
|
|
|
flangeButton = new QPushButton(centralwidget);
|
|
flangeButton->setObjectName(QString::fromUtf8("flangeButton"));
|
|
|
|
tabLayout->addStretch();
|
|
tabLayout->addWidget(flangeButton);
|
|
|
|
clearanceButton = new QPushButton(centralwidget);
|
|
clearanceButton->setObjectName(QString::fromUtf8("clearanceButton"));
|
|
|
|
tabLayout->addStretch();
|
|
tabLayout->addWidget(clearanceButton);
|
|
|
|
gyroscopeButton = new QPushButton(centralwidget);
|
|
gyroscopeButton->setObjectName(QString::fromUtf8("gyroscopeButton"));
|
|
|
|
tabLayout->addStretch();
|
|
tabLayout->addWidget(gyroscopeButton);
|
|
tabLayout->addStretch();
|
|
|
|
|
|
|
|
stackedWidget = new QStackedWidget(centralwidget);
|
|
stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
|
|
|
|
monitorPage = new MonitorWidget();
|
|
monitorPage->setObjectName(QString::fromUtf8("monitorPage"));
|
|
stackedWidget->addWidget(monitorPage);
|
|
|
|
flangePage = new FlangeAnalyticWidget(monitorPage);
|
|
flangePage->setObjectName(QString::fromUtf8("flangePage"));
|
|
stackedWidget->addWidget(flangePage);
|
|
clearancePage = new ClearanceAnalyticWidget(monitorPage);
|
|
clearancePage->setObjectName(QString::fromUtf8("clearancePage"));
|
|
stackedWidget->addWidget(clearancePage);
|
|
gyroscopePage = new GyroscopeAnalyticWidget(monitorPage);
|
|
gyroscopePage->setObjectName(QString::fromUtf8("gyroscopePage"));
|
|
stackedWidget->addWidget(gyroscopePage);
|
|
|
|
verticalLayout->addWidget(stackedWidget);
|
|
verticalLayout->addLayout(tabLayout);
|
|
|
|
verticalLayout->setStretch(0, 2);
|
|
verticalLayout->setStretch(1, 40);
|
|
verticalLayout->setStretch(2, 3);
|
|
|
|
tabLayout->setStretch(0, 1);
|
|
tabLayout->setStretch(1, 1);
|
|
tabLayout->setStretch(2, 3);
|
|
tabLayout->setStretch(3, 1);
|
|
tabLayout->setStretch(4, 3);
|
|
tabLayout->setStretch(5, 1);
|
|
tabLayout->setStretch(6, 3);
|
|
tabLayout->setStretch(7, 1);
|
|
tabLayout->setStretch(8, 1);
|
|
tabLayout->setSpacing(5);
|
|
MainWindow->setCentralWidget(centralwidget);
|
|
|
|
setButtonMes();
|
|
|
|
// ???e?????????????
|
|
|
|
|
|
connect(closeButton, &QPushButton::clicked, MainWindow, &QMainWindow::close);
|
|
|
|
// ??????????
|
|
MainWindow->setWindowFlags(Qt::FramelessWindowHint);
|
|
|
|
curTimer = monitorPage->viewTimer;
|
|
|
|
QMetaObject::connectSlotsByName(MainWindow);
|
|
} // setupUi
|
|
|
|
|
|
void setButtonMes()
|
|
{
|
|
monitorButton->setText(QString("监控总览"));
|
|
flangeButton->setText(QString("法兰分析"));
|
|
clearanceButton->setText(QString("净空区域"));
|
|
gyroscopeButton->setText(QString("陀螺仪监测"));
|
|
|
|
connect(monitorButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = monitorPage->viewTimer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(0); });
|
|
connect(flangeButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = flangePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(1); });
|
|
connect(clearanceButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = clearancePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(2); });
|
|
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = gyroscopePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(3); });
|
|
|
|
// connect(flangeButton, &QPushButton::clicked, this, [=](){this->flangePage->addDevice(); });
|
|
// connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearancePage->addDevice(); });
|
|
// connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->gyroscopePage->addDevice(); });
|
|
|
|
connect(monitorButton, &QPushButton::clicked, this, [=](){this->clearButton();});
|
|
connect(flangeButton, &QPushButton::clicked, this, [=](){this->clearButton();});
|
|
connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearButton();});
|
|
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->clearButton();});
|
|
connect(monitorButton, &QPushButton::clicked, this, [=](){monitorButton->setChecked(true);});
|
|
connect(flangeButton, &QPushButton::clicked, this, [=](){flangeButton->setChecked(true);});
|
|
connect(clearanceButton, &QPushButton::clicked, this, [=](){clearanceButton->setChecked(true);});
|
|
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){gyroscopeButton->setChecked(true);});
|
|
|
|
monitorButton->setCheckable(true);
|
|
flangeButton->setCheckable(true);
|
|
clearanceButton->setCheckable(true);
|
|
gyroscopeButton->setCheckable(true);
|
|
|
|
monitorButton->setChecked(true);
|
|
} // retranslateUi
|
|
|
|
void clearButton(){
|
|
monitorButton->setChecked(false);
|
|
flangeButton->setChecked(false);
|
|
clearanceButton->setChecked(false);
|
|
gyroscopeButton->setChecked(false);
|
|
}
|
|
|
|
MainWindow(){
|
|
this->setupUi(this);
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|