#include "widgetyz.h" #include #include "ui_widgetYZ.h" #include #include #include "UI/Language/Index.h" widgetYZ::widgetYZ(QWidget *parent) :QWidget(parent), ui(new Ui::widgetYZ) { ui->setupUi(this); setWindowFlags(this->windowFlags() &~ Qt::WindowMaximizeButtonHint); connect(ui->YZQRBtn, &QPushButton::clicked,this, &widgetYZ::QRBtnFun); connect(ui->YZQXBtn, &QPushButton::clicked,this, &widgetYZ::QXBtnFun); LanguageSwitching(); } widgetYZ::~widgetYZ() { delete ui; } void widgetYZ::QRBtnFun(){ if(ui->YZMMInput->text() == "123456"){ auto* win = new widget3(); // 获取屏幕的几何尺寸 QScreen *screen = QGuiApplication::primaryScreen(); QRect screenGeometry = screen->geometry(); int x = (screenGeometry.width() - width()) / 2; int y = (screenGeometry.height() - height()) / 2; // 移动窗口到计算出的中心位置 win->move(x, y); win->show(); this->close(); } else{ QMessageBox::warning(nullptr, Index::Lang("Hint").c_str(), Index::Lang("IncorrectPassword").c_str()); } } void widgetYZ::QXBtnFun(){ this->close(); } void widgetYZ::LanguageSwitching() { ui->label->setText(Index::Lang("label_tyz").c_str()); ui->YZMMInput->setPlaceholderText(Index::Lang("YZMMInput_tyz").c_str()); ui->YZQRBtn->setText(Index::Lang("YZQRBtn").c_str()); ui->YZQXBtn->setText(Index::Lang("YZQXBtn").c_str()); }