#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
//设置图片logoLab 标签的图片
ui->logoLab->setPixmap(QPixmap(":/pictrue/logo.png"));
ui->logoLab->setScaledContents(true);
//设置 zhwb 输入框的占位文本
ui->zhwb->setPlaceholderText("手机/QQ号码/邮箱");
//设置 mmwb 输入框的占位文本和回显模式
ui->mmwb->setPlaceholderText("密码");
//回显模式设置
ui->mmwb->setEchoMode(QLineEdit::Password);
//设置 zh 标签的图片
ui->zh->setPixmap(QPixmap(":/pictrue/userName.jpg"));
ui->zh->setScaledContents(true);
//设置 mm标签的图片
ui->mm->setPixmap(QPixmap(":/pictrue/passwd.jpg"));
ui->mm->setScaledContents(true);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_dlan_clicked()
{
// 获取输入的账号和密码
QString a = ui->zhwb->text();
QString b = ui->mmwb->text();
// 验证账号和密码
if (a == "admin" && b == "123456")
{
qDebug() << "登录成功";
this->close(); // 关闭当前界面
}
else
{
qDebug() << "登录失败";
// 清空账号和密码输入框
ui->zhwb->clear();
ui->mmwb->clear();
}
}
