-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
29 lines (24 loc) · 1008 Bytes
/
Copy pathgame.cpp
File metadata and controls
29 lines (24 loc) · 1008 Bytes
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 "game.h"
Game::Game(QWidget *parent) :
QWidget(parent)
{
setupUi(this);
graphics = 0;
mainMenu = new MainMenu(); //выделение памяти под объект MainMenu
stackedWidget->addWidget(mainMenu); // вставляет в stackedWidget объeкт graphics, при этом номер объекта graphics становится 2
stackedWidget->setCurrentIndex(2); // устанавливает в stackedWidget текущую страницу по номеру
connect(mainMenu->pushButton,SIGNAL(clicked(bool)),this,SLOT(playGame()));
}
void Game::playGame()
{
if(graphics == 0)
{
graphics = new Graphics();//выделение памяти под объект graphics
stackedWidget->addWidget(graphics); // вставляет в stackedWidget объeкт graphics, при этом номер объекта graphics становится 2
}
stackedWidget->setCurrentIndex(3);
}
Game::~Game()
{
//delete ui;
}