feat: add a fullscreen shortcut

This commit is contained in:
Gary Wang 2020-05-19 14:08:29 +08:00
parent 1864ff5b7f
commit fe0b36dc34
2 changed files with 14 additions and 0 deletions

View File

@ -125,6 +125,10 @@ MainWindow::MainWindow(QWidget *parent) :
connect(nextPictureShorucut, &QShortcut::activated, connect(nextPictureShorucut, &QShortcut::activated,
this, &MainWindow::galleryNext); this, &MainWindow::galleryNext);
QShortcut * fullscreenShorucut = new QShortcut(QKeySequence(QKeySequence::FullScreen), this);
connect(fullscreenShorucut, &QShortcut::activated,
this, &MainWindow::toggleFullscreen);
centerWindow(); centerWindow();
} }
@ -561,3 +565,12 @@ void MainWindow::quitAppAction(bool force)
closeWindow(); closeWindow();
} }
} }
void MainWindow::toggleFullscreen()
{
if (isFullScreen()) {
showNormal();
} else {
showFullScreen();
}
}

View File

@ -53,6 +53,7 @@ protected slots:
void toggleStayOnTop(); void toggleStayOnTop();
bool stayOnTop(); bool stayOnTop();
void quitAppAction(bool force = false); void quitAppAction(bool force = false);
void toggleFullscreen();
private: private:
QPoint m_oldMousePos; QPoint m_oldMousePos;