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. Access QWebKit (QML based 5.2+ alpha) from C++
Forum Updated to NodeBB v4.3 + New Features

Access QWebKit (QML based 5.2+ alpha) from C++

Scheduled Pinned Locked Moved Unsolved Qt WebKit
4 Posts 2 Posters 1.3k Views 1 Watching
  • 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
    scotryder
    wrote on last edited by
    #1

    Hi there,

    i'm building a sample app that uses QML for UI and WebKit View. I want to access and call functions on QML based QWebKit from C++. How can i achieve that?

    Thanks

    K 1 Reply Last reply
    0
    • S scotryder

      Hi there,

      i'm building a sample app that uses QML for UI and WebKit View. I want to access and call functions on QML based QWebKit from C++. How can i achieve that?

      Thanks

      K Offline
      K Offline
      Konstantin Tokarev
      wrote on last edited by
      #2

      You need to include private headers of QtWebKit like private/qquickwebview_p.h and get access to QQuickWebView object from your scene

      See e.g. https://code.woboq.org/qt5/qtwebkit/Tools/MiniBrowser/qt/BrowserWindow.cpp.html#_ZNK13BrowserWindow7webViewEv

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

        Thank you for your reply, looks like i dont get reply notifications

        i saw the code but looks like its all happening in main file.

        I created a simple Quick App, i exposed a C++ class WebKitController to QML and put both QML WebKit {} and my WebKitController{} in qml main file.
        now i want to call a function on WebKitController.onCompleted{} that pass the WebKit QML object or its id to my cpp class. I dont know what my cpp class will expect here and what should i pass actually?

        Thanks again

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Konstantin Tokarev
          wrote on last edited by
          #4

          What's wrong with accessing webview in the same way as in example above, i.e. property of a root object?

          In my recent project I use a different approach, my QML scene is really minimalistic (WebView and splash screen only), so I construct it fully in C++

          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