summaryrefslogtreecommitdiffstats
path: root/labb4/qgameoverwindow.cpp
blob: 5a3b3597368d6962a5bf3ff9d8de6f636cf77739 (plain) (blame)
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
/**
 * TDDD86 Robots
 * This file contains the implementation of the QGameOverWindow class.
 */

#include "qgameoverwindow.h"
#include "qresetbutton.h"

#include <QVBoxLayout>
#include <QLabel>

QGameOverWindow::QGameOverWindow(QWidget *parent) :
    QWidget(parent) {
    setStyleSheet("QGameOverWindow { background: rgb(237,224,200); }");
    setFixedSize(425, 205);
    QVBoxLayout *layout = new QVBoxLayout(this);

    // game over label
    QLabel* gameover = new QLabel("Game Over!", this);
    gameover->setStyleSheet("QLabel { color: rgb(119,110,101); font: 40pt; font: bold;} ");

    // reset button
    reset = new QResetButton(this);
    reset->setFixedHeight(50);
    reset->setFixedWidth(100);

    // add game over label to window
    layout->insertWidget(0, gameover, 0, Qt::AlignCenter);

    // add reset button to window
    layout->insertWidget(1, reset, 0, Qt::AlignCenter);
}

QGameOverWindow::~QGameOverWindow() {
    delete reset;
    delete gameover;
    delete layout;
}

QResetButton* QGameOverWindow::getResetBtn() const {
    return reset;
}