#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
ui->label->setPixmap(QPixmap(":/picture/1.png"));
ui->label->setScaledContents(true);
ui->lineEdit_2->setEchoMode(QLineEdit::Password);
connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(my_slots1()));
connect(ui->pushButton,&QPushButton::clicked,this,&Widget::checkLogin);
}
Widget::~Widget()
{
delete ui;
}
void Widget::my_slots1()
{
this->close();
}
void Widget::checkLogin()
{
if(ui->lineEdit->text()=="admin" && ui->lineEdit_2->text() == "123456")
{
qDebug() << "登录成功";
this->close();
}
else{
qDebug() << "登录失败";
ui->lineEdit_2->clear();
}
}
QT_day2
最新推荐文章于 2024-08-19 22:22:49 发布