From 1f7f9884f5d3345a918734969a57ad8236efbeaa Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 6 Jul 2022 08:21:51 -0400 Subject: [PATCH] Experiment with a fullscreen toggle. --- OSBindings/Qt/mainwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 39a1b646a..4f24435c4 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -478,6 +478,18 @@ void MainWindow::addDisplayMenu(const std::string &machinePrefix, const std::str QAction *sVideoAction = nullptr; QAction *rgbAction = nullptr; + // Add the fullscreen toggle. + QAction *const fullscreenToggleAction = new QAction(tr("Toggle fullscreen")); + fullscreenToggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_F)); + displayMenu->addAction(fullscreenToggleAction); + connect(fullscreenToggleAction, &QAction::triggered, this, [=] { + if(window()->isFullScreen()) { + window()->showNormal(); + } else { + window()->showFullScreen(); + } + }); + // Add all requested actions. #define Add(name, action) \ if(!name.empty()) { \