#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
QMovie *mv = new QMovie(":/newPicture/valorant.jpg");
ui->logoLab->setMovie(mv);
mv->start();
ui->logoLab->setScaledContents(true);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_loginBtn_clicked()
{
if(ui->passwdEdit->text() == "123456" && ui->userNameEdit->text() == "admin")
{
QMessageBox::information(
this,
"登录提示",
"登录成功"
);
emit login_signal();
this->close();
}
else
{
int res = QMessageBox::question(
this,
"登录提示",
"账户和密码怒匹配,是否继续登录?"
);
if(res == QMessageBox::Yes)
{
ui->passwdEdit->clear();
ui->userNameEdit->clear();
}
else if(res == QMessageBox::No)
{
this->close();
}
}
}
void Widget::on_closeBtn_clicked()
{
QMessageBox box(
QMessageBox::Question,
"关闭提示",
"是否确认关闭?",
QMessageBox::Yes | QMessageBox::No,
this);
int res = box.exec();
if(res == QMessageBox::Yes)
{
this->close();
}
else if(res == QMessageBox::No)
{
box.close();
}
}
Day11.15
最新推荐文章于 2024-11-11 15:21:43 发布