Is there a bug in following behavior of QWebView / QWebPage?

PROGRAM 1:
----------------------------------

import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import QWebView

if __name__ == "__main__":
    app = QApplication(sys.argv)

    def on_load_finished(*args):
        print("on load finish called")

    webview = QWebView()
    webview.show()
    QObject.connect(webview.page(), SIGNAL("loadFinished(bool)"),
on_load_finished )
    webview.page().mainFrame().load(QUrl('http://www.google.com/ncr'))
    app.exec_()

--------------------------------------

In this case, the "on_load_finished" function is NOTcalled

However, if I cache the page, like following,

PROGRAM 2
----------------------------------------

import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import QWebView

if __name__ == "__main__":
    app = QApplication(sys.argv)

    def on_load_finished(*args):
        print("on load finish called")

    webview = QWebView()
    webview.show()
    page = webview.page() #THIS LINE WAS ADDED
    QObject.connect(webview.page(), SIGNAL("loadFinished(bool)"),
on_load_finished )
    webview.page().mainFrame().load(QUrl('http://www.google.com/ncr'))
    app.exec_()
------------------------------------------

Then the on_load_finished function DOES get called in this case

why the odd behavior? issit some sort of bug or issit just something I am
not aware of? I tried looking up the documentation but there is nothing
documenting this behavior.

Thanks for reading.
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to