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);