
#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //设置窗口大小
    this->resize(1000,740);
    //设置窗口图标
    this->setWindowIcon(QIcon("C:\\Users\\Administrator\\Desktop\\pictrue\\Plants.png"));
    //设置窗口标题
    this->setWindowTitle("植物大战僵尸");
    //设置固定窗口大小
    this->setFixedSize(1000,740);
    //设置无边框
//    this->setWindowFlag(Qt::FramelessWindowHint);
    //创建背景标签
    QLabel *lab1= new QLabel(this);
    //设置标签大小
    lab1->resize(1000,740);
    //设置标签图片
    lab1->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\pictrue\\3.png"));
    //设置图片自适应
    lab1->setScaledContents(true);
    //360*450 200*200
    //创建加载标签(动图)
    QLabel *lab2= new QLabel(this);
    //设置标签大小
    lab2->resize(300,300);
    //设置标签位置
    lab2->move(360,200);
    //设置动图
    QMovie *mv1 = new QMovie("C:\\Users\\Administrator\\Desktop\\pictrue\\Ajax.gif");
    //动图放入标签中
    lab2->setMovie(mv1);
    //让动图动起来
    mv1->start();
    //动图自适应
    lab1->setScaledContents(true);
    //200*380  0*400
    //创建戴夫标签(动图)
    QLabel *lab3 = new QLabel(this);
    //设置标签大小
    lab3->resize(300,380);
    //设置标签位置
    lab3->move(0,400);
    //接收动图
    QMovie *mv2 = new QMovie("C:\\Users\\Administrator\\Desktop\\pictrue\\2.gif");
    lab3->setMovie(mv2);
    mv2->start();
    lab3->setScaledContents(true);
    //创建用户名文本框
    QLineEdit *line1 = new QLineEdit(this);
    //300*35  66*106
    //设置文本大小
    line1->resize(300,35);
    //设置文本框位置
    line1->move(66,106);
    //设置文本框颜色
    line1->setStyleSheet("background-color:rgb(82,70,50);color:white");
    //设置文本框提示
    line1->setPlaceholderText("用户名");
    //400*100 500*147
    //创建按钮1
    QPushButton *but1 = new QPushButton("冒险模式",this);
    //设置按钮大小
    but1->resize(400,100);
    //设置按钮位置
    but1->move(500,110);
    //设置按钮属性
    but1->setStyleSheet("background-color:rgb(122,123,132);font-size:50px;border-radius:10px");
    //创建按钮2
    QPushButton *but2 = new QPushButton("迷你游戏",this);
    but2->resize(400,100);
    but2->move(500,225);
    but2->setStyleSheet("background-color:rgb(122,123,132);font-size:50px;border-radius:10px");
    //创建按钮3
    QPushButton *but3 = new QPushButton("益智游戏",this);
    but3->resize(400,100);
    but3->move(500,340);
    but3->setStyleSheet("background-color:rgb(122,123,132);font-size:50px;border-radius:10px");
    //创建按钮4
    QPushButton *but4 = new QPushButton("无尽模式",this);
    but4->resize(400,100);
    but4->move(500,455);
    but4->setStyleSheet("background-color:rgb(122,123,132);font-size:50px;border-radius:10px");
    //120*220 250*30
    //创建按钮5
    QPushButton *but5 = new QPushButton("点击这里 创建用户",this);
    but5->resize(250,30);
    but5->move(110,170);
    but5->setStyleSheet("background-color:rgb(118,103,78);color:white;font-size:25px");
}
MyWidget::~MyWidget()
{
}
 
 



















