PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 354 - QWebView.setPage() does not seem to work
: QWebView.setPage() does not seem to work
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtWebKit
: HEAD
: PC Linux
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-09-10 17:50 EEST by Andy
Modified: 2010-10-13 13:48 EEST (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy 2010-09-10 17:50:45 EEST
When I call setPage in PySide, it does not seem to work the way I expect

Here's some code that works in PyQt4:

from sys import exit
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebView, QWebPage

class testWebPage(QWebPage):
    def sayMyName(self):
        return 'testWebPage'

app = QApplication([])
webview = QWebView()

twp = testWebPage()
print type(twp)
print twp.sayMyName()
webview.setPage(twp)
p = webview.page()
print type(p)
print p.sayMyName()

exit(app.exec_())

the output is, as I expect:

$ python set_webpage_pyqt.py 
<class '__main__.testWebPage'>
testWebPage
<class '__main__.testWebPage'>
testWebPage

but with PySide, the very similar code:

from sys import exit
from PySide.QtGui import QApplication
from PySide.QtWebKit import QWebView, QWebPage

class testWebPage(QWebPage):
    def sayMyName(self):
        return 'testWebPage'

app = QApplication([])
webview = QWebView()

twp = testWebPage()
print type(twp)
print twp.sayMyName()
webview.setPage(twp)
p = webview.page()
print type(p)
print p.sayMyName()

exit(app.exec_())

fails, producing the output:

$ python set_webpage.py
<class '__main__.testWebPage'>
testWebPage
<type 'PySide.QtWebKit.QWebPage'>
Traceback (most recent call last):
  File "set_webpage.py", line 18, in <module>
    print p.sayMyName()
AttributeError: 'PySide.QtWebKit.QWebPage' object has no attribute 'sayMyName'

which to me indicates that setPage didn't work.

Thanks for taking a look at this.  If I have made any mistake in filing this
bug let me know and I'll correct it.
Comment 1 Hugo Parente Lima 2010-09-10 19:42:12 EEST
Fixed in commit:

pyside/cbf12bc3a010508081d59bdac832d3e2bb9e0c2a
Comment 2 renato filho 2010-10-13 13:48:38 EEST
released on PySide 0.4.2