#include #include #include #include #include #include #include #include #include #include #include "./MonitorUI/MonitorUI.h" #include "./AnalyticUI/ClearanceAnalyticUI.h" #include "./AnalyticUI/FlangeAnalyticUI.h" #include "./AnalyticUI/GyroscopeAnalyticUI.h" 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; Ui::MonitorWidget *monitorPage; Ui::ClearanceAnalyticWidget *clearancePage; Ui::FlangeAnalyticWidget *flangePage; Ui::GyroscopeAnalyticWidget *gyroscopePage; 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, 0, 0); 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")); monitorButton = new QPushButton(centralwidget); monitorButton->setObjectName(QString::fromUtf8("monitorButton")); tabLayout->addWidget(monitorButton); flangeButton = new QPushButton(centralwidget); flangeButton->setObjectName(QString::fromUtf8("flangeButton")); tabLayout->addWidget(flangeButton); clearanceButton = new QPushButton(centralwidget); clearanceButton->setObjectName(QString::fromUtf8("clearanceButton")); tabLayout->addWidget(clearanceButton); gyroscopeButton = new QPushButton(centralwidget); gyroscopeButton->setObjectName(QString::fromUtf8("gyroscopeButton")); tabLayout->addWidget(gyroscopeButton); verticalLayout->addLayout(tabLayout); stackedWidget = new QStackedWidget(centralwidget); stackedWidget->setObjectName(QString::fromUtf8("stackedWidget")); monitorPage = new Ui::MonitorWidget(); monitorPage->setObjectName(QString::fromUtf8("monitorPage")); stackedWidget->addWidget(monitorPage); flangePage = new Ui::FlangeAnalyticWidget(); flangePage->setObjectName(QString::fromUtf8("flangePage")); stackedWidget->addWidget(flangePage); clearancePage = new Ui::ClearanceAnalyticWidget(); clearancePage->setObjectName(QString::fromUtf8("clearancePage")); stackedWidget->addWidget(clearancePage); gyroscopePage = new Ui::GyroscopeAnalyticWidget(); gyroscopePage->setObjectName(QString::fromUtf8("gyroscopePage")); stackedWidget->addWidget(gyroscopePage); verticalLayout->addWidget(stackedWidget); verticalLayout->setStretch(0, 2); verticalLayout->setStretch(1, 3); verticalLayout->setStretch(2, 40); MainWindow->setCentralWidget(centralwidget); retranslateUi(MainWindow); // 设置按钮点击跳转窗口 connect(monitorButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(0); }); connect(flangeButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(1); }); connect(clearanceButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(2); }); connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(3); }); connect(closeButton, &QPushButton::clicked, MainWindow, &QMainWindow::close); // 设置无边框窗口 MainWindow->setWindowFlags(Qt::FramelessWindowHint); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr)); minButton->setText(QString()); closeButton->setText(QString()); monitorButton->setText(QCoreApplication::translate("MainWindow", "\347\233\221\346\216\247\346\200\273\350\247\210", nullptr)); flangeButton->setText(QCoreApplication::translate("MainWindow", "\346\263\225\345\205\260\345\210\206\346\236\220", nullptr)); clearanceButton->setText(QCoreApplication::translate("MainWindow", "\345\207\200\347\251\272\345\210\206\346\236\220", nullptr)); gyroscopeButton->setText(QCoreApplication::translate("MainWindow", "\351\231\200\350\236\272\344\273\252\347\233\221\346\265\213", nullptr)); } // retranslateUi MainWindow(){ this->setupUi(this); } };