Skip to content

Commit

Permalink
Add main menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisD3D committed Apr 1, 2024
1 parent 56c500a commit 8fb6ad5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/screens/snakewindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ SnakeWindow::SnakeWindow(QWidget *pParent, Qt::WindowFlags flags)
const auto menuBar = new QMenuBar;

const auto fileMenu = new QMenu(tr("&File"), this);
const QAction *mainMenuAction = fileMenu->addAction(tr("&Main Menu"));
const QAction *fullScreenAction = fileMenu->addAction(tr("Full &Screen"));
const QAction *exitAction = fileMenu->addAction(tr("E&xit"));
menuBar->addMenu(fileMenu);

// Toggle full screen when the "Full Screen" action is triggered
connect(mainMenuAction, &QAction::triggered, this, [this] {
stackedWidget->setCurrentWidget(mainMenu);
});
connect(fullScreenAction, &QAction::triggered, this, &SnakeWindow::toggleFullScreen);

// Connect the "Exit" action to the application's quit slot
connect(exitAction, &QAction::triggered, qApp, &QApplication::quit);


Expand Down

0 comments on commit 8fb6ad5

Please sign in to comment.