Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [Solved] QtWebKit Bridge

    Qt WebKit
    3
    4
    3924
    Loading More Posts
    • 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.
    • D
      DaveSab last edited by

      I am trying to compile the bridge example (contained here: "qtwebkit-bridge.html":http://doc.qt.nokia.com/4.7/qtwebkit-bridge.html).

      As with the above, the only example snippets I can find on the web, start with a pointer to the page object:

      @
      QWebFrame *frame = myWebPage->mainFrame();
      frame->addToJavaScriptWindowObject("someNameForMyObject", myObject);
      @

      I have used the designer to create the QtWebView object, and in my MainWindow code, I try to get to the page object by using the ui object thus:

      @
      QWebFrame * frame = ui->webView->page()->mainFrame();
      frame->addToJavaScriptWindowObject("NameOfMyObject", myObject);
      @
      I get the following error: "Invalid Use of incomplete type 'struct QWebFrame'" pointing at the second line.

      I have even tried using a signal which fires when the QWebView object has loaded, with the same error.

      Does anyone have an example of how I am supposed to get the pointer to the frame object, so that I can initialise the webkit bridge call?

      Any sample code, would be much appreciated.

      [edit: Markup code and link, Tobias Hunger]

      1 Reply Last reply Reply Quote 0
      • D
        danilocesar last edited by

        You need to include the qwebframe file in your cpp.

        #include <QWebFrame>

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

        1 Reply Last reply Reply Quote 0
        • A
          anselmolsm last edited by

          DaveSab, besides that, add the following to your .pro:

          @
          QT += webkit
          @

          Then you won't get a linker error. In "this link":http://doc.qt.nokia.com/4.7/qtwebkit.html#including-in-your-project you find additional info about it.

          PS: Please edit your post to format the code and links. Thanks =)

          Anselmo L. S. Melo (anselmolsm)

          1 Reply Last reply Reply Quote 0
          • D
            DaveSab last edited by

            Doh! That was pretty basic mistake. :-(

            And yes, I have already run into the problem with the .pro file.

            Thanks for the quick responses, and I'll get with the program when it comes to formatting...

            1 Reply Last reply Reply Quote 0
            • First post
              Last post