- #include "widget.h"
- #include "ui_widget.h"
-
- Widget::Widget(QWidget *parent)
- : QWidget(parent)
- , ui(new Ui::Widget)
- {
- ui->setupUi(this);
- s1=new second;
- connect(this,&Widget::jump,s1,&second::jump_slot);
- ui->lab1->setPixmap(QPixmap(":/tu/nsh.png"));
- ui->lab1->setScaledContents(true);
- ui->lab2->setPixmap(QPixmap(":/tu/zh.jpg"));
- ui->lab2->setScaledContents(true);
- ui->lab3->setPixmap(QPixmap(":/tu/mm.png"));
- ui->lab3->setScaledContents(true);
- }
-
- Widget::~Widget()
- {
- delete ui;
- }
-
-
- void Widget::on_buf1_clicked()
- {
- if(ui->lin1->text()=="admin"&&ui->lin2->text()=="123456")
- {
- QMessageBox box(QMessageBox::Information,
- "信息对话框",
- "登录成功",
- QMessageBox::Ok,
- this);
-
- int ret = box.exec();
- if(ret == QMessageBox::Ok)
- {
- emit jump();
- this->close();
- }
- }else
- {
- QMessageBox box(QMessageBox::Warning,
- "错误对话框",
- "账号密码不匹配是否重新登录",
- QMessageBox::Ok|QMessageBox::Cancel,
- this);
- int ret = box.exec();
- if(ret == QMessageBox::Ok)
- {
- //清空密码
- ui->lin2->clear();
- }
- else if(ret == QMessageBox::Cancel)
- {
- this->close();
- }
- }
- }
-
- void Widget::on_buf2_clicked()
- {
- int ret=QMessageBox::question(this,
- "问题",
- "是否确认退出",
- QMessageBox::Yes|QMessageBox::No,
- QMessageBox::No);
- if(ret == QMessageBox::Yes)
- {
- this->close();
- }
- else if(ret==QMessageBox::No)
- {
-
- }
- }