remember is window was maximised before fullscreen

This commit is contained in:
Malte Jürgens 2022-07-27 19:38:09 +02:00
parent cfbb4152c3
commit 5f9211f98f
No known key found for this signature in database
GPG Key ID: D29FBD5F93C0CFC3
2 changed files with 7 additions and 1 deletions

View File

@ -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(); }

View File

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