From 77300ed178d1045d7389887bd11c5cc8214fd4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Wed, 27 Jul 2022 14:13:59 +0200 Subject: [PATCH] allow discord to go fullscreen --- src/discordpage.h | 1 + src/mainwindow.cpp | 12 +++++++++++- src/mainwindow.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/discordpage.h b/src/discordpage.h index 82b95f3..152575a 100644 --- a/src/discordpage.h +++ b/src/discordpage.h @@ -4,6 +4,7 @@ #include "virtmic.h" #include +#include #include class DiscordPage : public QWebEnginePage { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 533fbbf..b9085c2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -23,8 +23,18 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { } void MainWindow::setupWebView() { - m_webView = new QWebEngineView(this); auto page = new DiscordPage(this); + connect(page, &QWebEnginePage::fullScreenRequested, this, + &MainWindow::fullScreenRequested); + + m_webView = new QWebEngineView(this); m_webView->setPage(page); + setCentralWidget(m_webView); } + +void MainWindow::fullScreenRequested( + QWebEngineFullScreenRequest fullScreenRequest) { + fullScreenRequest.accept(); + fullScreenRequest.toggleOn() ? showFullScreen() : showNormal(); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index d8ece10..c7274d3 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -21,4 +21,7 @@ private: QWebEngineView *m_webView; QWebEngineProfile *prepareProfile(); DiscordPage *m_discordPage; + +private Q_SLOTS: + void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); };