Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. SetPage possibly not working on QWebView in PySide?
QtWS25 Last Chance

SetPage possibly not working on QWebView in PySide?

Scheduled Pinned Locked Moved Language Bindings
5 Posts 3 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    selfpropelled
    wrote on last edited by
    #1

    When I call setPage in PySide, it does not seem to work the way I expect, but perhaps I need to call it differently.

    Here's some code that works in PyQt4, though you have to kill it externally since I don't know how to do so programmatically (as an aside, I would love to know):

    @rom 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. So is there a bug in my thinking, in PySide, or elsewhere? Thanks in advance!

    Andy

    1 Reply Last reply
    0
    • D Offline
      D Offline
      danilocesar
      wrote on last edited by
      #2

      File a bug report at "http://bugs.openbossa.org/":http://bugs.openbossa.org/

      <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
      Software Engineer

      1 Reply Last reply
      0
      • S Offline
        S Offline
        selfpropelled
        wrote on last edited by
        #3

        Ok, thanks.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hugopl
          wrote on last edited by
          #4

          Fixed in commit:

          "http://qt.gitorious.org/pyside/pyside/commit/cbf12bc3a010508081d59bdac832d3e2bb9e0c2a":http://qt.gitorious.org/pyside/pyside/commit/cbf12bc3a010508081d59bdac832d3e2bb9e0c2a

          but the fix will just be on 0.4.2, because we already tagged the next version.

          [edit: fixed link / chetankjain]

          1 Reply Last reply
          0
          • S Offline
            S Offline
            selfpropelled
            wrote on last edited by
            #5

            Ah, thanks. I already filed the bug, should I close it?

            Edit: Never mind, I see that someone else closed it for me. Thanks.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved