-
Notifications
You must be signed in to change notification settings - Fork 1
/
result.cpp
44 lines (36 loc) · 913 Bytes
/
result.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
#include "result.h"
Result::Result()
{
text = new QLabel(this);
again_button = new QPushButton("Play again");
exit_button = new QPushButton("Quit");
}
void Result::_run(int x)
{
Layout = new QGridLayout;
Layout->addWidget(text,0,0,2,2);
Layout->addWidget(again_button,2,0);
Layout->addWidget(exit_button,2,1);
setLayout(Layout);
resize(250,200);
if(x==0)
{
setWindowTitle(QObject::tr("Win!"));
text->setText("Congratulations!");
text->setStyleSheet("color:red;");
text->setFont(QFont("Timers", 20, QFont::Bold));
}
else
{
setWindowTitle(QObject::tr("Failed!"));
QMovie *qq;
if(x==-1)
qq = new QMovie("boom.gif");
else
qq = new QMovie("too_young.gif");
text->setMovie(qq);
qq->setScaledSize(QSize(220,150));
qq->start();
}
show();
}