第六日

今天我进行了代码编写,在一番努力下,编写出了剩余代码,即完成了奖品部分即抽奖部分的程序设计,基本上可以实现抽奖了。

但我们还有很多后续工作要做,所以还需要努力。

#include "startwidget.h"
#include<QHBoxLayout>
startwidget::startwidget(QWidget *parent) :
    QWidget(parent)
{
    this->setFixedSize(400,500);
    this->setAutoFillBackground(true);
    QPalette palette;
    palette.setBrush(QPalette::Background,QBrush(QPixmap(":/new/prefix1/02.png")));
    this->setPalette(palette);
    this->Oksetbutton=new QPushButton("开始抽奖");
     this->Oksetbutton->setFixedSize(60,50);
    this->retbutton=new QPushButton("返回上级");
     this->retbutton->setFixedSize(60,50);
    auto hlayouy=new QHBoxLayout;
    hlayouy->addWidget(retbutton);
    hlayouy->addWidget(Oksetbutton);
    hlayouy->setContentsMargins(0,200,0,0);
    this->setLayout(hlayouy);

    connect(Oksetbutton,&QPushButton::clicked,[this](){
        emit startfinished();   //发出完成信号
    });
    connect(retbutton,&QPushButton::clicked,[this](){
        this->hide();   //隐藏自己
        emit retfinished(); //并发出信号
    });
}
posted on 2018-11-20 20:37  meikoqqq  阅读(116)  评论(0编辑  收藏  举报