#include "lander.h"
#include "ui_lander.h"
lander::lander(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::lander)
{
ui->setupUi(this);
///
/*窗口*/
this->setFixedSize(530,400);
this->setWindowIcon(QIcon(":/icon/01.jpg"));
this->setWindowTitle("析木");
this->setStyleSheet("background-color:white;");
///
/*logo*/
this->lable1 = new QLabel(this);
this->lable1->move(190,0);
this->lable1->resize(150,150);
this->lable1->setScaledContents(true);
this->lable1->setPixmap(QPixmap(":/icon/01.jpg"));
///
/*账户*/
this->lable2 = new QLabel(this);
this->lable2->move(120,180);
this->lable2->resize(30,30);
this->lable2->setScaledContents(true);
this->lable2->setPixmap(QPixmap(":/icon/zhanghu.png"));
ui->userNameEdit->move(170,180);
ui->userNameEdit->resize(220,30);
ui->userNameEdit->setPlaceholderText("账户");
///
/*密码*/
this->lable3 = new QLabel(this);
this->lable3->move(120,230);
this->lable3->resize(30,30);
this->lable3->setScaledContents(true);
this->lable3->setPixmap(QPixmap(":/icon/mima.png"));
ui->pwdEdit->move(170,230);
ui->pwdEdit->resize(220,30);
ui->pwdEdit->setPlaceholderText("密码");
ui->pwdEdit->setEchoMode(QLineEdit::Password);
///
/*登录*/
ui->loginBtn->move(170,280);
ui->loginBtn->resize(100,30);
ui->loginBtn->setStyleSheet("background-color:light gray;");
/*取消*/
ui->cancelBtn->move(290,280);
ui->cancelBtn->resize(100,30);
ui->cancelBtn->setStyleSheet("background-color:light gray;");
// ui->cancelBtn->setEnabled(false);
///
/*手动连接信号*/
connect(ui->loginBtn,&QPushButton::clicked,this,&lander::my_loginBtn_clicked);
}
lander::~lander()
{
delete ui;
}
//自定义的处理loginBtn的函数
void lander::my_loginBtn_clicked()
{
QString userName = ui->userNameEdit->text();
QString pwd = ui->pwdEdit->text();
if(userName == "xx" && pwd == "123")
{
qDebug() << "登陆成功!";
this->close();
}
else
{
qDebug() << "登陆失败!";
ui->pwdEdit->clear();
}
}
void lander::on_cancelBtn_clicked()
{
this->close();
}
04/26课后作业(C++)
最新推荐文章于 2024-07-14 15:36:20 发布