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()
{
}

效果展示

相关推荐
李广坤16 小时前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
爱可生开源社区2 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1772 天前
《从零搭建NestJS项目》
数据库·typescript
郑州光合科技余经理3 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1233 天前
matlab画图工具
开发语言·matlab
加号33 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
シ風箏3 天前
MySQL【部署 04】Docker部署 MySQL8.0.32 版本(网盘镜像及启动命令分享)
数据库·mysql·docker
dustcell.3 天前
haproxy七层代理
java·开发语言·前端
norlan_jame3 天前
C-PHY与D-PHY差异
c语言·开发语言
李慕婉学姐3 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端