qt登录框

#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    //窗口的设置
    this->setFixedSize(500, 400);   //设置固定大小
    this->setWindowOpacity(0.95);    //设置透明度
    this->setWindowTitle("鹏哥快聊");
//    this->setWindowFlag(Qt::FramelessWindowHint);   //设置纯净窗口

    //标题
    lb1 = new QLabel(this);
    lb1->setPixmap(QPixmap("D:\\ATK1w2\\下载\\QQ.png"));
    lb1->resize(50, 50);
    lb1->setScaledContents(true);


    lb2 = new QLabel("鹏哥快聊", this);
    lb2->resize(150, 50);
    lb2->move(50, 0);
    lb2->setScaledContents(true);
    lb2->setStyleSheet("background-color:red; color:yellow;");
    QFont font;

    font.setPointSize(20);
    lb2->setFont(font);

    int interval = 200;
    bool visible = true;
    QObject::connect(&timer, &QTimer::timeout, [&]()
    {
        if (visible)
        {
            lb2->hide();
        }
        else
        {
            lb2->show();
        }
        visible = !visible;
    });

    timer.start(interval);

    //登录框与密码框
    //图像准备
    lb3 = new QLabel(this);
    lb3->setPixmap(QPixmap("D:\\ATK1w2\\下载\\user.png"));
    lb3->resize(40, 40);
    lb3->setScaledContents(true);
    lb3->move(100,100);

    lb4 = new QLabel(this);
    lb4->setPixmap(QPixmap("D:\\ATK1w2\\下载\\pwd.png"));
    lb4->resize(50, 50);
    lb4->setScaledContents(true);
    lb4->move(95,200);

    //输入框
    qle1 = new QLineEdit(this);
    qle1->resize(200, 35);
    qle1->move(170, 105);

    qle2 = new QLineEdit(this);
    qle2->resize(200, 35);
    qle2->move(170, 210);
    qle2->setEchoMode(QLineEdit::Password);

    //登陆取消按钮
    lb5 = new QLabel(this);
    lb5->setPixmap(QPixmap("D:\\ATK1w2\\下载\\login.png"));
    lb5->resize(50, 50);
    lb5->setScaledContents(true);
    lb5->move(150,300);

    lb6 = new QLabel(this);
    lb6->setPixmap(QPixmap("D:\\ATK1w2\\下载\\cancel.png"));
    lb6->resize(40, 40);
    lb6->setScaledContents(true);
    lb6->move(300,300);

    qpb1 = new QPushButton(this);
    qpb1->setText("登录");
    qpb1->resize(70, 45);
    qpb1->move(200,300);
    font.setPointSize(15);
    qpb1->setFont(font);

    qpb2 = new QPushButton(this);
    qpb2->setText("取消");
    qpb2->resize(70, 45);
    qpb2->move(350,300);
    qpb2->setFont(font);


}

Widget::~Widget()
{
}

qt登录框_第1张图片

 

你可能感兴趣的:(qt,开发语言)