2024.05.06作业

自由发挥应用场景,实现登录界面。

要求:尽量每行代码都有注释。

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

yuanshen::yuanshen(QWidget *parent)
    : QWidget(parent)
{
    //==============窗口相关设置=======
    this->resize(1600,910);
    this->setFixedSize(1600,910);


    //窗口标题
    this->setWindowTitle("原神 4.0");
    //窗口图标
    this->setWindowIcon(QIcon("C:\\Users\\ShiSS\\Desktop\\pictrue\\logo.jpg"));
    //背景颜色
    this->setStyleSheet("background-color:rgb(20,20,20)");
    //去掉头部
    this->setWindowFlag(Qt::FramelessWindowHint);

    //============标签相关设置=======
    QLabel *lab3 = new QLabel("原神 ",this);
    //设置大小
    lab3->resize(40,40);
    //标签移动
    lab3->move(20,0);
    //标签字体颜色
    lab3->setStyleSheet("color:rgb(225,225,225)");


    QLabel *lab2 = new QLabel(" 4.0.0",this);
    lab2->resize(60,40);
    lab2->move(60,0);
    lab2->setStyleSheet("color:rgb(60,60,60)");

    //主体背景图
    QLabel *lab=new QLabel(this);
    lab->resize(1600,870);
    lab->move(0,35);
    lab->setPixmap(QPixmap("C:\\Users\\ShiSS\\Desktop\\pictrue\\40.jpg"));
    //自动适应
    lab->setScaledContents(true);

    //============按钮相关设置=======
    QPushButton *btn1=new QPushButton("开始游戏",this);
    //设置大小
    btn1->resize(255,80);
    //按钮移动
    btn1->move(1145,720);
    //按钮背景颜色
    btn1->setStyleSheet("background-color:rgb(255,199,8);border-radius:5px;color:rgb(119,76,33)");

    QPushButton *btn2=new QPushButton("三",this);
    //设置大小
    btn2->resize(50,80);
    //按钮移动
    btn2->move(1400,720);
    //按钮背景颜色
    btn2->setStyleSheet("background-color:rgb(255,199,8);border-radius:5px;color:rgb(148,106,24)");

    QFont font;
    font.setFamily("Arial");
    font.setPointSize(20);
    font.setBold(true);
    // 设置按钮的字体
    btn1->setFont(font);
}

yuanshen::~yuanshen()
{
}
相关推荐
Quz3 小时前
QML Hello World 入门示例
qt
xcyxiner3 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner4 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner4 天前
DicomViewer (添加模型类)3
qt
xcyxiner5 天前
DicomViewer (目录调整) 2
qt
xcyxiner5 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
桥田智能7 天前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
森G7 天前
75、服务器源码解析---------云视频服务项目
linux·服务器·网络·c++·qt
森G7 天前
77、线程池原理和实现------服务器源码解析----云视频服务项目
服务器·c++·qt
森G7 天前
71、打包发布---------打包发布
c++·qt