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

效果展示

相关推荐
m0_73011511几秒前
自动化机器学习(AutoML)库TPOT使用指南
jvm·数据库·python
qq_410194295 分钟前
SQL语句性能优化
数据库·sql·性能优化
luffy54595 分钟前
Rust语言入门-变量篇
开发语言·后端·rust
2301_8073671911 分钟前
C++中的模板方法模式
开发语言·c++·算法
weixin_5375904512 分钟前
《C程序语言设计》练习答案(练习1-3)
c语言·开发语言
m0_4592524624 分钟前
fastadmin动态渲染统计信息
开发语言·前端·javascript·php
小江的记录本36 分钟前
【MyBatis-Plus】Spring Boot + MyBatis-Plus 进行各种数据库操作(附完整 CRUD 项目代码示例)
java·前端·数据库·spring boot·后端·sql·mybatis
wanhengidc38 分钟前
《三国志异闻录》搬砖新游戏 云手机
运维·服务器·数据库·游戏·智能手机
傻啦嘿哟42 分钟前
Python 操作 Excel 条件格式指南
开发语言·python·excel
逆境不可逃43 分钟前
LeetCode 热题 100 之 33. 搜索旋转排序数组 153. 寻找旋转排序数组中的最小值 4. 寻找两个正序数组的中位数
java·开发语言·数据结构·算法·leetcode·职场和发展