一、自由发挥登录窗口的应用场景,实现一个登录窗口界面  
要求:每行代码都有注释  
【需要用到的图片或者动图,自己去网上找】  
1.mywidget.h代码  
#ifndef MYWIDGET_H
#define MYWIDGET_H
#include <QWidget>
#include <QIcon> //图标类
#include<QLabel> //标签类
#include<QMovie> //动图类
#include<QLineEdit> //行编辑器类
#include<QPushButton> //按钮类
class MyWidget : public QWidget
{
    Q_OBJECT
public:
    MyWidget(QWidget *parent = nullptr);
    ~MyWidget();
};
#endif // MYWIDGET_H2.mywidget.cpp代码  
#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //-------------窗口相关设置----------------
    this->setWindowTitle("用户登录"); //1.窗口标题
    this->setWindowIcon(QIcon("C:\\Users\\33492\\Pictures\\Camera Roll\\图片\\jye.png")); //2.窗口图标
    this->resize(612,946); //3.重设窗口大小
    this->setFixedSize(612,946); //4.固定窗口大小
    //this->setWindowFlag(Qt::FramelessWindowHint); //5.隐藏头部
    this->setStyleSheet("background-color:white");
    //-------------标签相关设置----------------
    QLabel *lal1 = new QLabel(this);
    lal1->resize(612,430); //1.重设标签大小
    QMovie *mv = new QMovie("C:\\Users\\33492\\Pictures\\Camera Roll\\图片\\longmao.gif"); //2.实例化一个动图对象
    lal1->setMovie(mv); //3.将动图设置到标签中
    mv->start(); //4.让动图动起来
    lal1->setScaledContents(true); //5.动图自动适应标签大小
    QLabel *lal2 = new QLabel(this);
    lal2->move(56,512); //1.移动到标签位置的首坐标
    lal2->resize(60,60);//2.重设标签大小
    lal2->setPixmap(QPixmap("C:\\Users\\33492\\Pictures\\Camera Roll\\图片\\R-C.png")); //3.设置一个图标
    lal2->setScaledContents(true); //4.自动适应
    QLabel *lal3 = new QLabel(this);
    lal3->move(56,588); //1.移动到标签位置的首坐标
    lal3->resize(60,60);//2.重设标签大小
    lal3->setPixmap(QPixmap("C:\\Users\\33492\\Pictures\\Camera Roll\\图片\\R-C (1).png")); //3.设置一个图标
    lal3->setScaledContents(true); //4.自动适应
    //-------------行编译器相关设置----------------
    QLineEdit *lie1 = new QLineEdit(this);
    lie1->move(120,512); //移动到要设行编译器的首坐标
    lie1->resize(450,60); //重设行编译器大小
    lie1->setPlaceholderText("用户名"); //占位显示用户名
    QLineEdit *lie2 = new QLineEdit(this);
    lie2->move(120,588); //移动到要设行编译器的首坐标
    lie2->resize(450,60); //重设行编译器大小
    lie2->setPlaceholderText("设置密码"); //占位显示用户名
    lie2->setEchoMode(QLineEdit::Password);
    //-------------按钮设置----------------
    QPushButton *pb1 = new QPushButton("注册",this);
    pb1->move(56,822); //移动到要设按钮的首坐标
    pb1->resize(240,70);//重设按钮大小
    pb1->setStyleSheet("background-color:rgb(8,189,252);color:white;border-radius:5px");//设定按钮颜色形状
    QPushButton *pb2 = new QPushButton("登录",this);
    pb2->move(344,822); //移动到要设按钮的首坐标
    pb2->resize(240,70);  //重设按钮大小
    pb2->setStyleSheet("background-color:rgb(8,189,252);color:white;border-radius:5px");//设定按钮颜色形状
}
MyWidget::~MyWidget()
{
}
3.运行效果图  
 
无头部效果  
 
二、思维导图