Qt day1

cpp 复制代码
#include "llgg.h"

llgg::llgg(QWidget *parent)
    : QMainWindow(parent)
{
    //设置窗口标题
    this->setWindowTitle("QQ登录");

    //固定窗口大小
    this->setFixedSize(400,560);

    //设置无边框窗口
    this->setWindowFlag(Qt::FramelessWindowHint);

    //设置背景颜色
    setStyleSheet("background-color: #f0f5ff;");

    //设置背景标签
    QLabel *lab = new QLabel(this);
    lab->resize(400,560);
    lab->setStyleSheet("background-color:green");
    //用动图类QMovie实例化一个动态
    QMovie *mv = new QMovie("C:\\Users\\HP\\Desktop\\mmexport1752132190690-ezgif.com-video-to-gif-converter.gif");

    //将动图放入标签
    lab->setMovie(mv);
    mv->start();
    //自动适应
    lab->setScaledContents(true);


    //设置最小化按钮
    QPushButton *minBtn = new QPushButton("-",this);
    minBtn->resize(50,30);
    minBtn->move(300,0);
    minBtn->setFlat(true);

    //设置关闭按钮
    QPushButton *cloBtn = new QPushButton("×",this);
    cloBtn->resize(50,30);
    cloBtn->move(350,0);
    cloBtn->setFlat(true);



    //创建账号行编辑器
    QLineEdit *acotEdit = new QLineEdit(this);

    acotEdit->resize(320,50);
    acotEdit->move(40,250);
    acotEdit->setPlaceholderText("账号");
    acotEdit->setStyleSheet("background-color:#42334B;border-radius:5px;color:white");

    //创建密码行编辑器
    QLineEdit *pwdEdit = new QLineEdit(this);
    pwdEdit->resize(320,50);
    pwdEdit->move(40,330);
    //密码行设置回显模式
    pwdEdit->setEchoMode(QLineEdit::Password);
    pwdEdit->setPlaceholderText("密码");
    pwdEdit->setStyleSheet("background-color:#42334B;border-radius:5px;color:white");

    //设置登录按钮
    QPushButton *loginBtn = new QPushButton("登录",this);
    loginBtn->resize(320,40);
    loginBtn->move(40,400);
    loginBtn->setStyleSheet("background-color:#1F3160;border-radius:5px;color:white");


    //设置扫码登录按钮
    QPushButton *codeloginbtn = new QPushButton("扫码登录",this);
    codeloginbtn->resize(80,30);
    codeloginbtn->move(100,500);
    codeloginbtn->setFlat(true);

    //设置更多选项
    QPushButton *morechoicebtn = new QPushButton("更多选项",this);
    morechoicebtn->resize(80,30);
    morechoicebtn->move(220,500);
    morechoicebtn->setFlat(true);

    //创建一个标签,用来显示图片
    QLabel *QQlab = new QLabel(this);
    QQlab->resize(150,150);
    QQlab->move(125,50);
    QQlab->setStyleSheet("background-color:green");

    //设置图片
    QQlab->setPixmap(QPixmap("C:\\Users\\HP\\Pictures\\OIP-C.webp"));

    //自动适应
    QQlab->setScaledContents(true);


}

llgg::~llgg()
{
}

效果展示

相关推荐
萧鼎2 小时前
Python 包管理的“超音速”革命:全面上手 uv 工具链
开发语言·python·uv
Dxy12393102162 小时前
MySQL如何高效查询表数据量:从基础到进阶的优化指南
数据库·mysql
Dying.Light2 小时前
MySQL相关问题
数据库·mysql
Anastasiozzzz2 小时前
Java Lambda 揭秘:从匿名内部类到底层原理的深度解析
java·开发语言
刘琦沛在进步2 小时前
【C / C++】引用和函数重载的介绍
c语言·开发语言·c++
蜡笔小炘3 小时前
LVS -- 利用防火墙标签(FireWall Mark)解决轮询错误
服务器·数据库·lvs
机器视觉的发动机3 小时前
AI算力中心的能耗挑战与未来破局之路
开发语言·人工智能·自动化·视觉检测·机器视觉
韩立学长3 小时前
基于Springboot泉州旅游攻略平台d5h5zz02(程序、源码、数据库、调试部署方案及开发环境)系统界面展示及获取方式置于文档末尾,可供参考。
数据库·spring boot·旅游
HyperAI超神经3 小时前
在线教程|DeepSeek-OCR 2公式/表格解析同步改善,以低视觉token成本实现近4%的性能跃迁
开发语言·人工智能·深度学习·神经网络·机器学习·ocr·创业创新
R_.L3 小时前
【QT】常用控件(按钮类控件、显示类控件、输入类控件、多元素控件、容器类控件、布局管理器)
开发语言·qt