allow discord to go fullscreen

This commit is contained in:
Malte Jürgens 2022-07-27 14:13:59 +02:00
parent 99df18ef89
commit 77300ed178
No known key found for this signature in database
GPG Key ID: D29FBD5F93C0CFC3
3 changed files with 15 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include "virtmic.h"
#include <QProcess>
#include <QWebEngineFullScreenRequest>
#include <QWebEnginePage>
class DiscordPage : public QWebEnginePage {

View File

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

View File

@ -21,4 +21,7 @@ private:
QWebEngineView *m_webView;
QWebEngineProfile *prepareProfile();
DiscordPage *m_discordPage;
private Q_SLOTS:
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
};