#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowIcon(QIcon(":/Logo/qq.jpg"));
ui->lineEdit_username->setText("admin");
ui->lineEdit_userpasswd->setText("123456");
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_pushButton_close_clicked()
{
this->close();
}
void Widget::on_pushButton_login_clicked()
{
QString name=ui->lineEdit_username->text();
QString passwd=ui->lineEdit_userpasswd->text();
if(name == "admin" && passwd == "123456"){
int ret = QMessageBox::information(this,
"登录成功!",
"将跳转下一个页面..",
QMessageBox::Ok |QMessageBox::No);
if(ret == QMessageBox::Ok){
this->close();
emit this->jump_alarm();
}
}else {
int ret = QMessageBox::critical(this,
"登录失败",
"账号密码不匹配,是否重新登录",
QMessageBox::Yes |QMessageBox::No);
if(ret == QMessageBox::Yes){
ui->lineEdit_username->clear();
ui->lineEdit_userpasswd->clear();
}else if(ret == QMessageBox::No){
int ret = QMessageBox::question(this,
"退出登录",
"您是否确定要退出登录",
QMessageBox::Yes |QMessageBox::No);
if(ret == QMessageBox::Yes){
this->close();
}else if(ret == QMessageBox::No){
}
}
}
}