QT DAY1

#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    this->setWindowTitle("EXVSDB");
    this->setWindowIcon(QIcon("C:\\Users\\dyj\\Pictures\\exvs2xb-title.png"));
    this->resize(540, 410);
    //设置纯净窗口 去掉头部
    this->setWindowFlag(Qt::FramelessWindowHint);
    //设置背景颜色
    this->setStyleSheet("background-color:White");

    QLabel *lab1 = new QLabel(this);
    lab1->resize(540, 157);
    lab1->setStyleSheet("background-color:pink");

    //设置动图
    QMovie *mv = new QMovie("C:\\Users\\dyj\\Pictures\\bili_v_1699873038780.gif");
    //将动图放进lab1中
    lab1->setMovie(mv);
    mv->start();
    //将动图自动适应lab
    lab1->setScaledContents(true);

    QLabel *lab2 = new QLabel(this);
    lab2->move(130,220);
    lab2->resize(20,20);
    lab2->setPixmap(QPixmap("C:\\Users\\dyj\\Desktop\\pictrue\\userName.jpg"));
    lab2->setScaledContents(true);

    QLabel *lab3 = new QLabel(this);
    lab3->move(130,250);
    lab3->resize(20,20);
    lab3->setPixmap(QPixmap("C:\\Users\\dyj\\Desktop\\pictrue\\passwd.jpg"));
    lab3->setScaledContents(true);
    QLabel *lab4 = new QLabel(this);
    lab4->resize(25,25);
    lab4->move(510,5);
    lab4->setPixmap(QPixmap("C:\\Users\\dyj\\Desktop\\pictrue\\R-C.png"));
    lab4->setScaledContents(true);

    QLineEdit *edit1 = new QLineEdit(this);
    edit1->resize(280, 20);
    edit1->move(150, 220);


    QLineEdit *edit2 = new QLineEdit(this);
    edit2->resize(280, 20);
    edit2->move(150, 250);
    edit2->setEchoMode(QLineEdit::Password);

    QPushButton *btn1 = new QPushButton(this);
    btn1->move(130, 300);
    btn1->resize(300,45);
    btn1->setText("登录");
    btn1->setStyleSheet("background-color:SteelBlue;border-radius:10px");
}

MyWidget::~MyWidget()
{

}

QT DAY1_第1张图片

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