[PyQt] Another wierd bug with QtWebKit
Phil Thompson
phil at riverbankcomputing.com
Sat Jan 9 09:33:23 GMT 2010
On Fri, 8 Jan 2010 22:54:36 -0800, Karthik Tharavaad
<karthiktharavaad at gmail.com> wrote:
> in the same vein as the thread from yesterday. I get an error from this:
>
> BEGIN PROGRAM-----------------
>
> import sys
> from PyQt4.QtGui import *
> from PyQt4.QtCore import *
> from PyQt4.QtWebKit import QWebView
> from PyQt4.QtNetwork import QNetworkAccessManager
>
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> view = QWebView()
> view.page().setNetworkAccessManager( QNetworkAccessManager() )
> view.page().mainFrame().load( QUrl("http://www.google.com") )
> view.show()
> sys.exit( app.exec_() )
>
> ----------------------------------------------
>
> This CRASHES upon running, while THIS
>
>
> BEGIN PROGRAM-----------------
>
> import sys
> from PyQt4.QtGui import *
> from PyQt4.QtCore import *
> from PyQt4.QtWebKit import QWebView
> from PyQt4.QtNetwork import QNetworkAccessManager
>
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> view = QWebView()
> manager = QNetworkAccessManager() # ADDED LINE, CACHING manager
> view.page().setNetworkAccessManager(manager)
> view.page().mainFrame().load( QUrl("http://www.google.com") )
> view.show()
> sys.exit( app.exec_() )
>
> ----------------------------------------------
>
> seems like when I create the QNetworkAccessManager(), it gets destroyed
> right away after it gets added with setNetworkAccessManager(), however,
> this
> should not be the case since QNetworkAccessManager is a QObject and
should
> be properly parented to the QWebPage when its added
No it shouldn't. If that were the case how would you use a manager with
more than one page?
Phil
More information about the PyQt
mailing list