[PyQt] strange QWebView/QWebPage behavior
Karthik Tharavaad
karthiktharavaad at gmail.com
Fri Jan 8 18:33:50 GMT 2010
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100108/d198bcbe/attachment.html>
More information about the PyQt
mailing list