我想QtWebEngineWidgets.QWebEngineView
在 Windows 下使用 WebGL 和我的Qt 5.9.2
.
但是当我尝试加载webglreport.com
时,QWebEngineView
它告诉我,"This browser supports WebGL 2, but it is disabled or unavailable."
我该如何解决?
这是我的代码:
PyQt:
import os, sys
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
# app.setAttribute(QtCore.Qt.AA_UseOpenGLES) # nothing happens, you can comment it out
view = QtWebEngineWidgets.QWebEngineView()
# view.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.WebGLEnabled, True) # does not help too = (((
view.load(QtCore.QUrl("http://webglreport.com/?v=2"))
view.show()
sys.exit(app.exec_())
# And here WebGL Report will tell me: "This browser supports WebGL 2, but it is disabled or unavailable."
# How can I cope with it???
C++ Qt:
#include <QApplication>
#include <QtWebEngineWidgets/QWebEngineView>
#include <QUrl>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView view;
view.load(QUrl("http://webglreport.com/"));
view.show();
return a.exec();
}