#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_login_btn_clicked()
{
if(ui->usrline->text() == "12345" &&ui->pwdline->text() == "12345")//登录成功
{
QMessageBox::information(
this,"信息","登录成功",QMessageBox::Ok);
this->close();
//跳转其他界面
emit my_signal();
}
else//登录失败
{
QMessageBox msg(
QMessageBox::Critical,"错误","账号或密码不匹配,是否重新登录",
QMessageBox::Yes|QMessageBox::No,this);
int ret = msg.exec();
if(ret == QMessageBox::Yes)
{
ui->pwdline->clear();//清空密码内容
}
else if(ret == QMessageBox::No)
{
this->close();//关闭登录界面
}
}
}
void Widget::on_login_btn_2_clicked()
{
int ret = QMessageBox::question(
this,"问题","您是否确定要退出登录?",QMessageBox::Yes|QMessageBox::No);
if(ret == QMessageBox::Yes)//确定退出,退出登录界面
{
this->close();
}
else if(ret == QMessageBox::No)//取消退出,继续执行登录
{
}
}
QT day4
最新推荐文章于 2024-08-29 23:53:52 发布