Description
The current PySide2 5.9 branch (5.9.0a1 - built on Windows via https://codereview.qt-project.org/pyside/pyside-setup on 20 April 2018) contains the QWebEnginePage.runJavaScript() function.
This function works fine with a single argument containing a string of JavaScript code. However, there is no ability to return a 'resultCallback' as in the original Qt function:
https://doc.qt.io/qt-5.9/qwebenginepage.html#runJavaScript-2
The following, for example:
class Browser(QtWebEngineWidgets.QWebEngineView):
def _init_(self, main, mainWin, centralWidget):
super()._init_()
def buttonPushed(self):
self.page().runJavaScript('hello', self.printResult)
def printResult(self, result):
print(result)
generates:
TypeError: 'PySide2.QtWebEngineWidgets.QWebEnginePage.runJavaScript' called with wrong argument types:
PySide2.QtWebEngineWidgets.QWebEnginePage.runJavaScript(str, method)
Supported signatures:
PySide2.QtWebEngineWidgets.QWebEnginePage.runJavaScript(unicode)
PySide2.QtWebEngineWidgets.QWebEnginePage.runJavaScript(unicode, unsigned int)
Are their plans to update this function to return callback results?
(I am aware that it is possible to work around this by getting JavaScript to create a console message, which can then be filtered by overriding QWebEnginePage.consoleMessage. But, it would be nice to be able to exploit the full capability of the original runJavaScript function.)
Thanks.
Attachments
Issue Links
- duplicates
-
PYSIDE-946 Missing methods for QWebEnginePage with QWebEngineCallback
- Closed