-
Notifications
You must be signed in to change notification settings - Fork 0
/
openingmenu.cpp
37 lines (30 loc) · 1.19 KB
/
openingmenu.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 "openingmenu.h"
OpeningMenu::OpeningMenu()
{
setFixedHeight(600);
setFixedWidth(300);
m_play = new MainWindow();
m_play->setPlayMode(true);
m_replay = new MainWindow();
m_replay->setPlayMode(false);
m_replay->menuBar()->hide();
labelTitle = new QLabel("Minesweeper");
btnStart = new QPushButton("Start");
btnReplay = new QPushButton("Replay");
btnHelp = new QPushButton("Help");
btnExit = new QPushButton("Exit");
layoutMain = new QGridLayout;
layoutMain->addWidget(labelTitle, 0, 0, 1, 3, Qt::AlignHCenter);
layoutMain->addWidget(btnStart, 1, 1, 1, 1, Qt::AlignHCenter);
layoutMain->addWidget(btnReplay, 2, 1, 1, 1, Qt::AlignHCenter);
layoutMain->addWidget(btnHelp, 3, 1, 1, 1, Qt::AlignHCenter);
layoutMain->addWidget(btnExit, 4, 1, 1, 1, Qt::AlignHCenter);
this->setLayout(layoutMain);
connect(btnStart, &QPushButton::clicked, m_play, &MainWindow::show);
connect(btnReplay, &QPushButton::clicked, m_replay, &MainWindow::show);
connect(btnExit, &QPushButton::clicked, this, &OpeningMenu::close);
connect(btnHelp, &QPushButton::clicked, [](){
DialogHelp dialogHelp;
dialogHelp.exec();
});
}