From 5f9211f98ff9754d88101c93f771f6e40636b578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Wed, 27 Jul 2022 19:38:09 +0200 Subject: [PATCH] remember is window was maximised before fullscreen --- src/mainwindow.cpp | 7 ++++++- src/mainwindow.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1fc9da8..4b34f83 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,7 +36,12 @@ void MainWindow::setupWebView() { void MainWindow::fullScreenRequested( QWebEngineFullScreenRequest fullScreenRequest) { fullScreenRequest.accept(); - fullScreenRequest.toggleOn() ? showFullScreen() : showNormal(); + if (fullScreenRequest.toggleOn()) { + m_wasMaximized = isMaximized(); + showFullScreen(); + } else { + m_wasMaximized ? showMaximized() : showNormal(); + } } void MainWindow::closeEvent(QCloseEvent *event) { QApplication::quit(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 617cb7d..666dbc0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -22,6 +22,7 @@ private: QWebEngineProfile *prepareProfile(); DiscordPage *m_discordPage; void closeEvent(QCloseEvent *event) override; + bool m_wasMaximized; private Q_SLOTS: void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);