Reputation: 1
Using PyQt5 QWebEngineView, I cannot use fullScreen when watching video:
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtWebEngineWidgets import *
app=QtWidgets.QApplication(sys.argv)
w=QWebEngineView()
w.settings().setAttribute(QWebEngineSettings.PluginsEnabled, True)
w.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, True)
w.settings().setAttribute(QWebEngineSettings.FullScreenSupportEnabled, True)
w.page().fullScreenRequested.connect(QWebEngineFullScreenRequest.accept)
w.load(QtCore.QUrl('56.com/w94/play_album-aid-14364505_vid-MTQ3NDUxMjY3.html'))
w.showMaximized()
app.exec_()
Upvotes: 0
Views: 605
Reputation: 11
you can reference bellow code:
m_webView->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
connect(m_webView->page(), &QWebEnginePage::fullScreenRequested, this, [this]
(QWebEngineFullScreenRequest fullScreenRequest) {
fullScreenRequest.accept();
qDebug()<<"UI: fullScreenRequested: "<<fullScreenRequest.toggleOn()<<endl;
});
Upvotes: 1
Reputation: 111
QWebEnginePage::fullScreenRequested signal has an argument named "request" and it has a function named "accept()". So you have to call
request.accept()
but your code uses the type name (QWebEngineFullScreenRequest) and doesn't refer to this exact object.
https://doc.qt.io/qt-5/qwebenginepage.html#fullScreenRequested
Upvotes: 0