[PyQt] Overriding shouldInterruptJavaScript

Brian Zambrano brianz at gmail.com
Tue Aug 9 18:35:11 BST 2011


In my QWebPage, I'd like to override the shouldInterruptJavaScript method so
that it ignores long running javascript warning.

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.html#shouldInterruptJavaScript

*Warning:* Because of binary compatibility constraints, this function is not
> virtual. If you want to provide your own implementation in a QWebPage<http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.html> subclass,
> reimplement the shouldInterruptJavaScript() slot in your subclass instead.
> QtWebKit<http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtwebkit.html> will
> dynamically detect the slot and call it.


However, when I override it, it appears to never be called.

class DebugWebPage(QWebPage):

    @pyqtSlot(bool)
    def shouldInterruptJavaScript(self):
        print 'not interrupting'
        return False

It looks like someone else hit the same issue with PySide:

http://stackoverflow.com/questions/6868286/override-shouldinterruptjavascript-in-qwebpage-with-pyside

I'm tried with and without the pyqtSlot decorator with the same results.

Insight appreciated,
BZ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110809/e99b6647/attachment.html>


More information about the PyQt mailing list