#include "work2.h"
#include "ui_work2.h"
Work2::Work2(QWidget *parent) :
QWidget(parent),
ui(new Ui::Work2)
{
ui->setupUi(this);
this->setFixedSize(this->width(), this->height());
this->setWindowFlag(Qt::FramelessWindowHint);
//上部logo
QMovie *mv = new QMovie(":/pictrue/qq2.gif");
ui->log_lab->setMovie(mv);
mv->start();
//输入框设置
ui->account_line->setStyleSheet("background-color:white; border-radius:5px;");
ui->pwd_line->setStyleSheet("background-color:white; border-radius:5px;");
//按钮设置
ui->login_btn->setStyleSheet("background-color:white; border-radius:10px;");
ui->cancel_btn->setStyleSheet("background-color:white; border-radius:10px;");
//基于qt4版本的connect
connect(ui->cancel_btn, SIGNAL(clicked()), this, SLOT(cancel_slots()));
//基于qt5版本的connect
connect(ui->login_btn, &QPushButton::clicked, this, &Work2::login_slots);
}
Work2::~Work2()
{
delete ui;
}
//登录的槽
void Work2::login_slots()
{
if(ui->account_line->text() == "admin" && ui->pwd_line->text() == "123456"){
qDebug() << "登录成功";
this->close();
}else{
qDebug() << "登录失败";
ui->pwd_line->clear();
}
}
//取消的槽
void Work2::cancel_slots()
{
this->close();
}