-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchoosemode.cpp
37 lines (30 loc) · 938 Bytes
/
choosemode.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
#include "choosemode.h"
#include <QCloseEvent>
#include <QCoreApplication>
ChooseMode::ChooseMode(QWidget *parent) : QDialog(parent)
{
botButton = new QPushButton("Jouer contre le Bot", this);
playerButton = new QPushButton("Jouer contre un autre joueur", this);
setWindowTitle("Puissance 4 !");
setFixedSize(300, 150); // Empêcher le redimensionnement de la fenêtre
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(botButton);
layout->addWidget(playerButton);
connect(botButton, &QPushButton::clicked, this, &ChooseMode::onBotClicked);
connect(playerButton, &QPushButton::clicked, this, &ChooseMode::onPlayerClicked);
}
void ChooseMode::onBotClicked()
{
emit modeSelected(true);
accept();
}
void ChooseMode::onPlayerClicked()
{
emit modeSelected(false);
accept();
}
void ChooseMode::closeEvent(QCloseEvent *event)
{
QCoreApplication::quit();
_exit(0);
}