widget.cpp
- #include "widget.h"
- #include "ui_widget.h"
-
- Widget::Widget(QWidget *parent)
- : QWidget(parent)
- , ui(new Ui::Widget)
- {
- ui->setupUi(this);
- QMovie *mv = new QMovie(":/pictrue/xhr.gif");
- ui->lab1->setMovie(mv);
- mv->start();
- ui->lineEdit->setPlaceholderText("账号");
- ui->lineEdit_2->setPlaceholderText("密码");
- }
-
- Widget::~Widget()
- {
- delete ui;
- }
-
- void Widget::my_close()
- {
- emit this->my_signal();
- this->close();
- }
-
-
- void Widget::on_pushButton_clicked()
- {
- if(ui->lineEdit->text()=="admin" && ui->lineEdit_2->text() =="123456")
- {
- int res = QMessageBox::information(this,"提示","登陆成功",QMessageBox::Ok);
- if(res == QMessageBox::Ok)
- {
- emit this->my_signal();
- this->close();
- }
- }
- else
- {
-
- int res = QMessageBox::critical(this,"错误","账号密码错误",QMessageBox::Yes | QMessageBox ::No);
- if(res == QMessageBox::Yes)
- {
- ui->lineEdit->setText("");
- ui->lineEdit_2->setText("");
- }
- else
- {
- this->close();
- }
-
- }
- }
-
- void Widget::on_quit_clicked()
- {
- // QMessageBox box1(
- // QMessageBox::information,
- // "提示",
- // "您是否确定要退出",
- // QMessageBox::Yes | QMessageBox::No,
- // this);
- // int res= box1.exec();
- int res = QMessageBox::information(this,"提示","您是否确定要退出",QMessageBox::Yes | QMessageBox ::No);
- if(res == QMessageBox::Yes)
- {
- this->close();
- }
- }
