#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
ui->logoLab->setPixmap(QPixmap(":/222/2222.gif"));
QMovie *mv = new QMovie(":/222/2222.gif");
ui->logoLab->setMovie(mv);
mv->start();
ui->logoLab->setScaledContents(true);
ui->userLab->setPixmap(QPixmap(":/222/ddk.jpg"));
ui->userLab->setScaledContents(true);
ui->passLab->setPixmap(QPixmap(":/222/R-C.gif"));
ui->passLab->setScaledContents(true);
ui->userEdit->setPlaceholderText("请输入账号");
ui->passEdit->setPlaceholderText("请输入密码");
ui->passEdit->setEchoMode(QLineEdit::Password);
ui->login->setIcon(QIcon(""));
ui->cancel->setIcon(QIcon(""));
connect(ui->cancel,SIGNAL(clicked()),this,SLOT(close()));
connect(this,&Widget::my_signal,[&](){
if(ui->userEdit->text()=="" || ui->passEdit->text()=="")
{
qDebug() << "账号或密码为空";
}else{
if(ui->userEdit->text()=="admin")
{
if(ui->passEdit->text()=="123456")
{
qDebug() << "登录成功";
this->close();
}else
{
qDebug() << "密码错误,请重新输入";
ui->passEdit->clear();
}
}else{
qDebug() << "账号不存在";
}
}
});
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_login_clicked()
{
emit my_signal();
}
10.18作业
最新推荐文章于 2024-11-14 12:29:08 发布