1.登陆界面
2.登陆失败
3.登陆成功弹窗
4.点击OK后跳转
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString username = ui->lineEdit->text();
QString password = ui->lineEdit_2->text();
if(username=="1" && password=="1")
{
int ret = QMessageBox::question(this,"问题","登陆成功",QMessageBox::Ok);
if(ret == QMessageBox::Ok)
{
emit this->tohome();
this->close();
}
}else{
int ret = QMessageBox::question(this,"问题","登陆失败",QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Ok)
{
this->close();
}else if(ret == QMessageBox::No)
{
ui->lineEdit->setText("");
ui->lineEdit_2->setText("");
}
}
}