0
点赞
收藏
分享

微信扫一扫

QT_day1

水沐由之 2024-05-12 阅读 7
#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{

    //修改窗口标题
    this->setWindowTitle("4.6.0");
    //修改窗口图标
    this->setWindowIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\icon"));
    //修改窗口大小
    this->resize(1920,1100);
    //固定窗口大小
    this->setFixedSize(1920,1100);
    //设置窗口背景颜色
    this->setStyleSheet("background-color:rgb(255,255,255)");
    //设置纯净窗口
    this->setWindowFlag(Qt::FramelessWindowHint);
    //创建标签
    QLabel *back=new QLabel(this);
    back->setPixmap(QPixmap("C:\\Users\\zj\\Desktop\\yuanshen\\background"));
    back->resize(1920,1100);
    back->setScaledContents(true);


    //创建开始游戏按钮
    QPushButton *startbtn=new QPushButton;
    //设置依赖的父组件
    startbtn->setParent(this);
    //设置文本内容
    startbtn->setText("开始游戏");

    //设置背景颜色
    startbtn->setStyleSheet("background-color:rgb(255,200,9);border:none");
    //重设置按钮大小
    startbtn->resize(300,100);
    //移动按钮
    startbtn->move(1380,930);
    //设置按钮字体和大小
    startbtn->setFont(QFont("幼圆",20));


    //本地文件按钮
    QPushButton *localbtn=new QPushButton(this);
    localbtn->resize(55,100);
    localbtn->move(1680,930);
    localbtn->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\menu"));
    localbtn->setStyleSheet("background-color:rgb(255,200,9);border:none");


    //创建标签,标题背景
    QLabel *titlelab=new QLabel(this);
    titlelab->resize(1920,60);
    titlelab->setStyleSheet("background-color:rgb(20,20,20)");

    //创建标签,标题名1
    QLabel *titlenamelab=new QLabel("原神",this);
    titlenamelab->resize(70,60);
    titlenamelab->move(20,0);
    //设置字体颜色
    titlenamelab->setStyleSheet("color:rgb(226,226,226);background-color:rgb(20,20,20)");

    //创建标签,标题名2
    QLabel *titlename2lab=new QLabel("4.6.0",this);
    titlename2lab->resize(70,60);
    titlename2lab->move(70,0);
    //设置字体颜色
    titlename2lab->setStyleSheet("color:rgb(65,65,65);background-color:rgb(20,20,20)");
    //设置字体及大小
    titlename2lab->setFont(QFont("Times New Roman",12));

    //创建设置按钮
    QPushButton *setbtn=new QPushButton(this);
    //设置按钮大小
    setbtn->resize(60,60);
    //移动按钮
    setbtn->move(1740,0);
    //设置图片
    setbtn->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\set"));
    setbtn->setStyleSheet("border:none;background-color:rgb(20,20,20)");

    //创建最小化按钮
    QPushButton *minbtn=new QPushButton(this);
    //设置按钮大小
    minbtn->resize(60,60);
    //移动按钮
    minbtn->move(1800,0);
    //设置图片
    minbtn->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\min"));
    minbtn->setStyleSheet("border:none;background-color:rgb(20,20,20)");
    connect(minbtn,&QPushButton::clicked,this,&MyWidget::min1);

    //创建关闭按钮
    QPushButton *closebtn=new QPushButton(this);
    //设置按钮大小
    closebtn->resize(60,60);
    //移动按钮
    closebtn->move(1860,0);
    //设置图片
    closebtn->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\close"));
    closebtn->setStyleSheet("border:none;background-color:rgb(20,20,20)");
    connect(closebtn,&QPushButton::clicked,this,&MyWidget::close1);

    //创建滚动标签
    QLabel *rolllab=new QLabel(this);
    rolllab->resize(690,320);
    rolllab->move(75,350);

    rolllab->setPixmap(QPixmap("C:\\Users\\zj\\Desktop\\yuanshen\\info1"));
    rolllab->setScaledContents(Qt::FramelessWindowHint);

    //创建活动底色标签
    QLabel *back2lab=new QLabel(this);
    back2lab->resize(690,60);
    back2lab->move(75,695);
    back2lab->setStyleSheet("background-color:rgba(27,33,39,100)");


    //创建活动按钮
    QPushButton *actbtn=new QPushButton("活动",this);
    actbtn->resize(110,60);
    actbtn->move(80,695);
    actbtn->setStyleSheet("border:none;background:transparent;color:rgb(255,255,255)");
    actbtn->setFont(QFont("幼圆",14));

    //创建公告按钮
    QPushButton *annbtn=new QPushButton("公告",this);
    annbtn->resize(110,60);
    annbtn->move(180,695);
    annbtn->setStyleSheet("border:none;background:transparent;color:rgb(255,255,255)");
    annbtn->setFont(QFont("幼圆",14));
    //创建资讯按钮
    QPushButton *infobtn=new QPushButton("资讯",this);
    infobtn->resize(110,60);
    infobtn->move(280,695);
    infobtn->setStyleSheet("border:none;background:transparent;color:rgb(255,255,255)");
    infobtn->setFont(QFont("幼圆",14));

    //创建版本活动按钮
    QPushButton *info2btn=new QPushButton("版本热点",this);
    info2btn->resize(210,60);
    info2btn->move(1520,810);
    info2btn->setStyleSheet("background-color:rgb(232,230,237);color:rgb(115,47,46);border-radius:30");
    info2btn->setFont(QFont("幼圆",14));

    //创建内容标签
    QLabel *infolab=new QLabel(this);
    infolab->resize(690,125);
    infolab->move(75,755);
    infolab->setStyleSheet("background-color:rgba(7,14,19,100)");

    //创建背景标签
    QLabel *back3lab=new QLabel(this);
    back3lab->resize(115,1040);
    back3lab->move(1805,60);
    //设置背景标签颜色及透明度
    back3lab->setStyleSheet("background-color:rgba(27,33,39,100)");

    //侧边按钮
    QPushButton *rbtn1=new QPushButton(this);
    rbtn1->resize(60,60);
    rbtn1->move(1830,125);
    rbtn1->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,0)");
    rbtn1->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\chat"));

    //侧边按钮微信
    QPushButton *rbtn2=new QPushButton(this);
    rbtn2->resize(60,60);
    rbtn2->move(1830,230);
    rbtn2->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,100)");
    rbtn2->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\wechat"));


    //侧边按钮微博
    QPushButton *rbtn3=new QPushButton(this);
    rbtn3->resize(60,60);
    rbtn3->move(1830,335);
    rbtn3->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,100)");
    rbtn3->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\sina"));

    //侧边按钮
    QPushButton *rbtn4=new QPushButton(this);
    rbtn4->resize(60,60);
    rbtn4->move(1830,440);
    rbtn4->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,100)");
    rbtn4->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\local"));


    //侧边按钮qq
    QPushButton *rbtn5=new QPushButton(this);
    rbtn5->resize(60,60);
    rbtn5->move(1830,545);
    rbtn5->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,100)");
    rbtn5->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\qq"));



    //侧边按钮
    QPushButton *rbtn6=new QPushButton(this);
    rbtn6->resize(60,60);
    rbtn6->move(1830,650);
    rbtn6->setStyleSheet("border-radius:30;background-color:rbga(0,0,0,100)");
    rbtn6->setIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\faq"));







}

MyWidget::~MyWidget()
{
}
void MyWidget::close1(){
    this->close();
}
void MyWidget::min1(){
    this->showMinimized();
}


 

举报

相关推荐

day1_QT

QT day1

嵌入式学习-qt-Day1

C++&QT---QT-day3

QT-DAY2

QT DAY3

【Qt】day2

Qt day4

Qt day2

QT DAY4

0 条评论