2024.4.9作业

#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();
    }
}
上一篇:JVS-智能BI数据分析:数仓+流程化加工的独特优势


下一篇:IDEA import时不使用*