-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.cpp
57 lines (44 loc) · 1.31 KB
/
Configuration.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
#include "Configuration.h"
Configuration::Configuration()
: QWidget(nullptr), mTreeCount{ 2 }, mTreeDepth{ 4 }
{
resize(400, 600);
auto* layout = new QVBoxLayout;
auto* start = new QPushButton("Start", this);
connect(start, &QPushButton::clicked, this, &Configuration::startClicked);
auto treeCountLabel = new QLabel("Nombre d'arbres");
auto* treeCount = new QSpinBox;
treeCount->setMinimum(1);
treeCount->setMaximum(10);
treeCount->setValue(mTreeCount);
connect(treeCount, &QSpinBox::valueChanged, this, &Configuration::treeCountClicked);
auto treeDepthLabel = new QLabel("Profondeur des arbres");
auto* treeDepth = new QSpinBox;
treeDepth->setMinimum(1);
treeDepth->setMaximum(7);
treeDepth->setValue(mTreeDepth);
connect(treeDepth, &QSpinBox::valueChanged, this, &Configuration::treeDepthClicked);
layout->addWidget(treeCountLabel);
layout->addWidget(treeCount);
layout->addWidget(treeDepthLabel);
layout->addWidget(treeDepth);
layout->addWidget(start);
layout->addStretch();
this->setLayout(layout);
}
Configuration::~Configuration()
{
}
void Configuration::treeCountClicked(int value)
{
mTreeCount = value;
}
void Configuration::treeDepthClicked(int value)
{
mTreeDepth = value;
}
void Configuration::startClicked()
{
emit done({ .treeCount = mTreeCount, .treeDepth = mTreeDepth });
hide();
}