QTDay1

 

MyWidget.cpp
#ifndef MYWIDGET_H
#define MYWIDGET_H

#include 
#include 
#include 
#include 
#include 

class MyWidget : public QWidget
{
    Q_OBJECT

public:
    MyWidget(QWidget *parent = nullptr);
    ~MyWidget();
};
#endif // MYWIDGET_H

main.cpp

#include "mywidget.h"

#include 

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MyWidget w;
    w.show();
    return a.exec();
}

MyWidget.cpp

#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //窗口设置
    this->resize(643,493);
    this->setStyleSheet("background-color:White");
    this->setWindowIcon(QIcon(""))
    //this->
    //动图
    QLabel *lab = new QLabel(this);
    lab->resize(643,190);
    QMovie *mv = new QMovie("C:\\Users\\赵大伟\\Desktop\\ICon\\qq.gif");
    lab->setMovie(mv);
    lab->setScaledContents(true);
    mv->start();
    //qqlogo
    QLabel *lab1 = new QLabel(this);
    lab1->resize(91,42);
    lab1->move(15,15);
    lab1->setPixmap(QPixmap("C:\\Users\\赵大伟\\Desktop\\ICon\\qq1.png"));
    //账号logo
    QLabel *lab2 = new QLabel(this);
    lab2->resize(22,35);
    lab2->move(150,240);
    lab2->setPixmap(QPixmap("C:\\Users\\赵大伟\\Desktop\\ICon\\qq2.png"));
    //密码logo
    QLabel *lab3 = new QLabel(this);
    lab3->resize(22,35);
    lab3->move(150,290);
    lab3->setPixmap(QPixmap("C:\\Users\\赵大伟\\Desktop\\ICon\\qq3.png"));
    //二维码
    QLabel *lab4 = new QLabel(this);
    lab4->resize(40,40);
    lab4->move(585,440);
    lab4->setPixmap(QPixmap("C:\\Users\\赵大伟\\Desktop\\ICon\\qq4.png"));
    //自动登录
    QLabel *lab5 = new QLabel("自动登录",this);
    lab5->move(180,345);
    //记住密码
    QLabel *lab6 = new QLabel("记住密码",this);
    lab6->move(300,345);
    //找回密码
    QLabel *lab7 = new QLabel("找回密码",this);
    lab7->move(410,345);
    //注册账号
    QLabel *lab8 = new QLabel("注册账号",this);
    lab8->move(20,455);
    //头像
    QLabel *lab9 = new QLabel(this);
    lab9->setPixmap(QPixmap("C:\\Users\\赵大伟\\Desktop\\ICon\\touxiang.jpg"));
    lab9->resize(90,90);
    lab9->setScaledContents(true);
    lab9->move(270,130);
    lab9->setStyleSheet("border-radius: 8");
    //头像
//    QPushButton *but2 = new QPushButton(this);
//    but2->move(270,130);
//    but2->resize(90,90);
//    but2->setIcon(QIcon("C:\\Users\\赵大伟\\Desktop\\ICon\\touxiang.jpg"));
//    but2->setStyleSheet("border-radius:8");

    //账号
    QLineEdit *ed1 = new QLineEdit(this);
    ed1->move(180,240);
    ed1->resize(300,35);
    //密码
    QLineEdit *ed2 = new QLineEdit(this);
    ed2->move(180,290);
    ed2->resize(300,35);
    ed2->setEchoMode(QLineEdit::Password);
    //登录按钮
    QPushButton *but1 = new QPushButton("登录",this);
    but1->move(150,400);
    but1->resize(330,55);
    but1->setStyleSheet("background-color:DeepSkyBlue;border-radius:8");


}

MyWidget::~MyWidget()
{
}

QTDay1_第1张图片

你可能感兴趣的:(QT)