-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidget.cpp
58 lines (48 loc) · 1.21 KB
/
widget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "widget.h"
#include "ui_widget.h"
#include "gameform.h"
#include <QFile>
#include <QMessageBox>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
QFile qss(":/white.qss");
qss.open(QFile::ReadOnly);
qApp->setStyleSheet(qss.readAll());
qss.close();
ui->setupUi(this);
this->move(600, 200);
this->setWindowTitle(QString("别踩白块儿"));
this->setFixedSize(360, 600); //5行4列
QPalette pal = this->palette();
pal.setBrush(QPalette::Background, QBrush(QPixmap(":/110.jpeg")));
setPalette(pal);
settingsForm = new SettingsForm;
settingsForm->setSpeed(1);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_pushButton_clicked()
{
GameForm *gameForm = new GameForm;
gameForm->move(this->pos());
gameForm->formInit(settingsForm->getSpeed());
gameForm->show();
this->close();
}
void Widget::on_pushButton_2_clicked()
{
this->close();
}
void Widget::on_pushButton_3_clicked()
{
settingsForm->move(this->pos());
settingsForm->show();
}
void Widget::on_pushButton_4_clicked()
{
QMessageBox::information(this, QString("config"), QString("Version1.0"), QMessageBox::Cancel, QMessageBox::Cancel);
}