diff --git a/mainwindow.cpp b/mainwindow.cpp index 7ce6342..3f0f25b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -125,6 +125,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(nextPictureShorucut, &QShortcut::activated, this, &MainWindow::galleryNext); + QShortcut * fullscreenShorucut = new QShortcut(QKeySequence(QKeySequence::FullScreen), this); + connect(fullscreenShorucut, &QShortcut::activated, + this, &MainWindow::toggleFullscreen); + centerWindow(); } @@ -561,3 +565,12 @@ void MainWindow::quitAppAction(bool force) closeWindow(); } } + +void MainWindow::toggleFullscreen() +{ + if (isFullScreen()) { + showNormal(); + } else { + showFullScreen(); + } +} diff --git a/mainwindow.h b/mainwindow.h index 8e054c0..ef3c65c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -53,6 +53,7 @@ protected slots: void toggleStayOnTop(); bool stayOnTop(); void quitAppAction(bool force = false); + void toggleFullscreen(); private: QPoint m_oldMousePos;