QtWebEngineWidgets in Maya2018
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Has anyone been trying to use PySide2's QtWebEngineWidgets that ships with Maya2018?
There seems to be bits missing when comparing it with the Qt5.9 docs. For example:
QWebEnginePage should have the following method from looking at the docs
runJavaScript(const QString &scriptSource, FunctorOrLambda resultCallback)
Which I would assume would translate across into PySide2 as something along the lines of:
runJavaScript(scriptSource, resultCallback)
However in PySide2 within Maya when I try running an example:
from PySide2.QtWebEngineWidgets import *
from PySide2.QtCore import *
view = QWebEngineView()
url = 'https://www.google.co.uk/'
view.load(QUrl(url))
view.show()
code = "document.getElementById('lst-ib')['value']"
def callback(value):
print(value)
view.page().runJavaScript(code, callback)I get the following error:
# Error: TypeError: file <maya console> line 13: runJavaScript() takes exactly one argument (2 given) #
Has this function not been ported across fully? There are other attributes missing such as: (and probably a lot more)
QWebEnginePage.toPlainText(callback) QWebEnginePage.toHtml(callback)
Is this an Autodesk issue that they aren't shipping a fully working QtWebEngineWidgets or is the PySide2 port still incomplete?
I need to use the runJavaScript function that takes a callback so I can use the result of my js code in my widget. Unlike the old QtWebKit, QtWebEngine in an asynchronous library, so relies on the use of callbacks to do anything that queries the page, that's why QWebElement was dropped (which is what I would have used otherwise).
Any help would be much appreciated, thanks!