-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPositionSelectionWindow.cpp
40 lines (35 loc) · 1.38 KB
/
PositionSelectionWindow.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
/**
* Fichier contenant la classe SelectStartupWindow qui g�n�re une fen�tre servant � s�lectionner le d�but de partie voulue.
* \file SelectStartupWindow.cpp
* \author Erreur-404 et Mo-LK
* \date 19 avril 2022
* Cr�� le 8 avril 2022
*/
#include "PositionSelectionWindow.hpp"
namespace view
{
void PositionSelectionWindow::createWindow(MainWindow& mainWindow)
{
setWindowTitle("Selection screen");
QString locations[4] = { "img/Pos1.png", "img/Pos2.png", "img/Pos3.png", "img/Pos4.png" };
QVBoxLayout* layout = new QVBoxLayout();
QLabel* label = new QLabel(this);
label->setText("Select the desired preset.");
label->setAlignment(Qt::AlignCenter);
layout->addWidget(label);
QHBoxLayout* selectionTable = new QHBoxLayout();
for (int i = 0; i < numberOfPresets; i++) {
QPushButton* button = new QPushButton("", this);
button->setWhatsThis(QString::fromStdString("Startup Position " + std::to_string(i + 1)));
button->setGeometry(i % 2 * xPosition, i / 2 * yPosition, widthDimension, heightDimension);
button->setIcon(QIcon(locations[i]));
button->setIconSize(QSize(widthDimension, heightDimension));
selectionTable->addWidget(button);
QObject::connect(button, &QPushButton::pressed,
&mainWindow, &MainWindow::selectStartupPosition);
}
layout->addLayout(selectionTable);
setLayout(layout);
setWindowModality(Qt::ApplicationModal);
}
}