使用PyQt5 QWebEngineView,我在观看视频时无法使用fullScreen:
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_()
QWebEnginePage :: fullScreenRequested信号有一个名为“request”的参数,它有一个名为“accept()”的函数。所以你必须打电话
request.accept()
但是您的代码使用类型名称(QWebEngineFullScreenRequest)并且不引用此确切对象。
https://doc.qt.io/qt-5/qwebenginepage.html#fullScreenRequested