Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [Solved] QtWebKit Bridge
QtWS25 Last Chance

[Solved] QtWebKit Bridge

Scheduled Pinned Locked Moved Qt WebKit
4 Posts 3 Posters 4.2k 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.
  • D Offline
    D Offline
    DaveSab
    wrote on last edited by
    #1

    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
    0
    • D Offline
      D Offline
      danilocesar
      wrote on last edited by
      #2

      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
      0
      • A Offline
        A Offline
        anselmolsm
        wrote on last edited by
        #3

        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
        0
        • D Offline
          D Offline
          DaveSab
          wrote on last edited by
          #4

          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
          0

          • Login

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