Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setBackgroundRole(QPalette::Light);
//设置窗体
this->setWindowTitle("华清远见");
this->setWindowIcon(QIcon("C:\\Users\\Administrator\\Desktop\\icon\\logo.png"));
this->setFixedSize(432,333);
QLabel*lab1=new QLabel;
lab1->setParent(this);
lab1->resize(30,30);
lab1->setScaledContents(true);
lab1->move(100,100);
lab1->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\icon\\userName.jpg"));
QLabel*lab2=new QLabel;
lab2->setParent(this);
lab2->resize(30,30);
lab2->setScaledContents(true);
lab2->move(100,140);
lab2->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\icon\\passwd.jpg"));
QLabel*lab3=new QLabel;
lab3->setParent(this);
lab3->resize(50,50);
lab3->setScaledContents(true);
lab3->move(170,30);
lab3->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\icon\\qq.png"));
QLineEdit *edt1=new QLineEdit;
edt1->setParent(this);
edt1->resize(150,30);
edt1->move(140,100);
edt1->setStyleSheet("border: none; border-bottom: 1px solid black;");
QLineEdit *edt2=new QLineEdit;
edt2->setParent(this);
edt2->resize(150,30);
edt2->move(140,140);
edt2->setStyleSheet("border: none; border-bottom: 1px solid black;");
edt2->setEchoMode(QLineEdit::Password);
QPushButton*bnt1=new QPushButton;
bnt1->setParent(this);
bnt1->resize(50,50);
// bnt1->setText("安全登录");
bnt1->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\icon\\login.png"));
bnt1->setIconSize(QSize(50,50));
bnt1->move(75,200);
QPushButton*bnt2=new QPushButton;
bnt2->setParent(this);
bnt2->resize(50,50);
// bnt2->setText("取消");
bnt2->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\icon\\cancel.png"));
bnt2->setIconSize(QSize(50,50));
bnt2->move(275,200);
connect(bnt1,&QPushButton::clicked,[=](){
//判断账号密码是否正确
if(edt1->text()=="admin"&&edt2->text()=="123456"){
qDebug()<<"登录成功";
}
else{
qDebug()<<"密码不正确";
edt2->clear();
}
});
connect(bnt2,&QPushButton::clicked,[&](){
close();
});
}
20230405QTQQ界面
最新推荐文章于 2025-05-12 09:59:19 发布