#include "widget.h"
#include "ui_widget.h"
#include "second.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_btn1_clicked()
{
if(ui->lineEdit->text() == "123" && ui->lineEdit_2->text() == "123")
{
QMessageBox msg(QMessageBox::Question,
"登录成功",
"登录成功",
QMessageBox::Ok
);
int ret = msg.exec();
if(ret == QMessageBox::Ok)
{
this->close();
emit my_signal();
}
}
else
{
QMessageBox msg(QMessageBox::Question,
"密码错误",
"是否重新登录",
QMessageBox::Yes | QMessageBox::No);
int ret = msg.exec();
if(ret == QMessageBox::Yes)
{
ui->lineEdit_2->setText("");
}
else if(ret == QMessageBox::No)
{
this->close();
}
}
}
void Widget::on_btn2_clicked()
{
QMessageBox msg(QMessageBox::Question,
"退出",
"是否退出登录",
QMessageBox::Yes | QMessageBox::No);
int ret = msg.exec();
if(ret == QMessageBox::Yes)
{
this->close();
}
else if(ret == QMessageBox::No)
{
msg.close();
}
}