思维导图:
作业:
cpp
#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_pushButton_clicked()
{
if(ui->lineEdit->text() == "admin" && ui->lineEdit_2->text() == "123")
{
QMessageBox msg(
QMessageBox::Information,
"提示",
"登录成功",
QMessageBox::Yes,
this);
msg.exec();
this->close();
emit my_jump();
}
else
{
int ret = QMessageBox::critical(
this,
"登录失败",
"账号密码不匹配",
QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes)
{
ui->lineEdit_2->clear();
}
else
{
this->close();
}
}
}
void Widget::on_pushButton_2_clicked()
{
int ret = QMessageBox::question(
this,
"?",
"退出登录?",
QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes)
{
this->close();
}
}