#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowIcon(QIcon(":/Logo/precure.jpg"));
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_pushButton_clicked()
{
if(ui->lineEdit->text()=="qiu"&&ui->lineEdit_2->text()=="123456")
{
QMessageBox msg(QMessageBox::Information,
"登录",
"登录成功",
QMessageBox::Ok,this);
if(msg.exec()==QMessageBox::Ok)
{
emit success();
close();
}
}
else
{
QMessageBox msg(QMessageBox::Warning,
"登录",
"账户和密码不匹配,是否重新登录?",
QMessageBox::Yes|QMessageBox::No,this);
int res=msg.exec();
if(res==QMessageBox::Yes)
{
ui->lineEdit->clear();
ui->lineEdit_2->clear();
}
else if (res==QMessageBox::No)
{
this->close();
}
}
}
void Widget::on_pushButton_2_clicked()
{
int ret=QMessageBox::question(this,
"关闭",
"是否想要关闭页面?",
QMessageBox::Yes|QMessageBox::No);
if(ret==QMessageBox::Yes)
{
this->close();
}
if(ret==QMessageBox::No)
{
}
}
01-10
于 2024-01-10 20:24:59 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)