-
Notifications
You must be signed in to change notification settings - Fork 6
/
MainWnd.cpp
79 lines (69 loc) · 1.76 KB
/
MainWnd.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "MainWnd.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
MainWnd::MainWnd(QWidget *parent) : QWidget(parent), _go(-1)
{
setFixedSize(750, 640);
game = new SingleGame;
panel = new CtrlPanel;
getNickName = new infoModel();
splash = new QSplashScreen;
black_label = new QLabel("傻强");
red_label = new QLabel;
QVBoxLayout* vLay = new QVBoxLayout;
vLay->addStretch();
vLay->addWidget(black_label);
vLay->addStretch();
vLay->addWidget(panel);
vLay->addStretch();
vLay->addWidget(red_label);
vLay->addStretch();
QHBoxLayout* hLay = new QHBoxLayout(this);
hLay->addWidget(game, 1);
hLay->addStretch();
hLay->addLayout(vLay);
connect(panel, SIGNAL(sigBack()), game, SLOT(slotBack()));
connect(game, SIGNAL(Fail()), this, SLOT(showFail()));
connect(game, SIGNAL(Win()), this, SLOT(showWin()));
}
MainWnd::~MainWnd()
{
}
void MainWnd::intoGame(int data)
{
getNickName->showData();
str = getNickName->nickName.at(data);
_go = data;
red_label->setText(str);
red_label->setStyleSheet("color:red");
black_label->setStyleSheet("color:black");
QFont ft;
ft.setPointSize(33);
red_label->setFont(ft);
black_label->setFont(ft);
}
void MainWnd::showFail()
{
label = new QLabel;
label->setStyleSheet("background-image:url(:/images/fail.jpg)");
label->setFixedSize(750, 640);
label->show();
for (int i = 0; i < 100; i++)
{
game->slotBack();
}
close();
}
void MainWnd::showWin()
{
label = new QLabel;
label->setStyleSheet("background-image:url(:/images/win.jpg)");
label->setFixedSize(750, 640);
label->show();
for (int i = 0; i < 100; i++)
{
game->slotBack();
}
close();
}