20230405QTQQ界面

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();
    });
}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值