forked from hBuzzy/TetrisSample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtetris.cpp
More file actions
29 lines (20 loc) · 1.09 KB
/
Copy pathtetris.cpp
File metadata and controls
29 lines (20 loc) · 1.09 KB
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
#include "tetris.h"
#include "ui_tetris.h"
Tetris::Tetris(QWidget *parent) : QMainWindow(parent), ui(new Ui::Tetris) {
ui->setupUi(this);
// Увеличиваем размер шрифта меню
menuBar()->setStyleSheet(QString("font-size: %1px").arg(14));
QMenu *gameMenu = menuBar()->addMenu("&Игра");
// Создаём объект класса QAction (действие) с названием Новая игра
QAction *startNewGame = new QAction("&Нова игра", this);
// Добавляем QAction в пункт меню Игра
gameMenu->addAction(startNewGame);
// Создаем соединени между слотом начала новой игры в GameField и QAction
connect(startNewGame, &QAction::triggered, ui->gameField,
&GameField::StartNewGame);
// Создаем соединени между слотом начала новой игры в классе GameField и
// кнопкой
connect(ui->newGameButton, &QPushButton::clicked, ui->gameField,
&GameField::StartNewGame);
}
Tetris::~Tetris() { delete ui; }