#include "widget.h"#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){ui->setupUi(this);//设置窗口属性this->setWindowTitle("Sumeru Dance Training");this->setFixedSize(800,600);this->setWindowIcon(QIcon("C:\\Users\\Administrator\\Desktop\\picture\\icon.png"));//设置登陆界面图片,用logo标签ui->label->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\picture\\no1.jpg"));ui->label->setScaledContents(true);//设置用户名和密码输入提示图标ui->username->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\icon\\userName.jpg"));ui->username->setFixedSize(30,30);ui->username->setScaledContents(true);ui->passwd->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\icon\\passwd.jpg"));ui->passwd->setFixedSize(30,30);ui->passwd->setScaledContents(true);ui->passwd_2->setEchoMode(QLineEdit::Password);//设置登陆按钮图标ui->yes->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\icon\\login.png"));ui->pushButton_2->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\icon\\cancel.png"));}Widget::~Widget(){delete ui;}//登陆按钮槽函数void Widget::on_yes_clicked(){QString usna = ui->username_2->text();QString pwd = ui->passwd_2->text();if("nilou"==usna && "20221203" == pwd){QMessageBox login_true(QMessageBox::Information," ","登陆成功!",QMessageBox::Ok|QMessageBox::No);if(login_true.exec() == QMessageBox::Ok){this->close();}}else{QMessageBox login_true(QMessageBox::Question," ","密码或用户名不支持,是否重新登陆?",QMessageBox::Ok|QMessageBox::No);if(login_true.exec() == QMessageBox::No){this->close();}}}//取消登陆槽函数void Widget::on_pushButton_2_clicked(){QMessageBox no_login(QMessageBox::Question," ","确认要退出吗?",QMessageBox::Yes|QMessageBox::No);if(no_login.exec() == QMessageBox::Yes){this->close();}}