allow discord to go fullscreen
This commit is contained in:
parent
99df18ef89
commit
77300ed178
|
@ -4,6 +4,7 @@
|
||||||
#include "virtmic.h"
|
#include "virtmic.h"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QWebEngineFullScreenRequest>
|
||||||
#include <QWebEnginePage>
|
#include <QWebEnginePage>
|
||||||
|
|
||||||
class DiscordPage : public QWebEnginePage {
|
class DiscordPage : public QWebEnginePage {
|
||||||
|
|
|
@ -23,8 +23,18 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupWebView() {
|
void MainWindow::setupWebView() {
|
||||||
m_webView = new QWebEngineView(this);
|
|
||||||
auto page = new DiscordPage(this);
|
auto page = new DiscordPage(this);
|
||||||
|
connect(page, &QWebEnginePage::fullScreenRequested, this,
|
||||||
|
&MainWindow::fullScreenRequested);
|
||||||
|
|
||||||
|
m_webView = new QWebEngineView(this);
|
||||||
m_webView->setPage(page);
|
m_webView->setPage(page);
|
||||||
|
|
||||||
setCentralWidget(m_webView);
|
setCentralWidget(m_webView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::fullScreenRequested(
|
||||||
|
QWebEngineFullScreenRequest fullScreenRequest) {
|
||||||
|
fullScreenRequest.accept();
|
||||||
|
fullScreenRequest.toggleOn() ? showFullScreen() : showNormal();
|
||||||
|
}
|
||||||
|
|
|
@ -21,4 +21,7 @@ private:
|
||||||
QWebEngineView *m_webView;
|
QWebEngineView *m_webView;
|
||||||
QWebEngineProfile *prepareProfile();
|
QWebEngineProfile *prepareProfile();
|
||||||
DiscordPage *m_discordPage;
|
DiscordPage *m_discordPage;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue