Qt Forum

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

    Forum Updated on Feb 6th

    HTML5-JS-C++ interaction

    QtWebEngine
    qt webengine
    4
    6
    2796
    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.
    • P
      pankaj4288 last edited by

      Hi,

      I am trying to develop an app for android/ios/windows for which I want UI to be in html/css.
      I tried using webkit, but I assume we can't use it anymore as it is deprecated and will be removed in future releases (moreover webkit was nit working on android mobile). So I used QTWebengine. Now my problem is when I try to communicate from my html to js it is fine, but from js to c++ is not working. Everywhere I am getting examples using webkit, but not with webengine. Can someone please help ?
      Also is it possible to create an app using html/css (and background in c++ communicating via js) to run fine on desktop and mobiles ??

      Thanks
      Pankaj Kushwaha

      1 Reply Last reply Reply Quote 0
      • C
        Clem last edited by

        @pankaj4288 said:

        my problem is when I try to communicate from my html to js it is fine, but from js to c++ is not working. Everywhere I am getting examples using webkit, but not with webengine. Can someone please help ?

        Hi Pankaj,

        From what I understood, you can have a look at QWebChannel standalone example given with Qt 5.5. It gets more complicated than with QtWebKit, and I was wondering if I were missing something or if it were supposed to change eventually, but I got no reply.

        Clem

        1 Reply Last reply Reply Quote 0
        • P
          pankaj4288 last edited by

          Thanks a lot..
          Yes the code is very complicated, and it seems that we are sending some data in json format from our C++ app to server and that is being displayed on browser. While I am looking for some example in which app's UI will be in html and all backend operations (like write/read database) will be in C++. These html will be rendered using QTWebengine, as QWebkit is deprecated.

          M 1 Reply Last reply Reply Quote 0
          • M
            maximus @pankaj4288 last edited by maximus

            @pankaj4288

            Hopefully they make some more examples and improvement so that using QWebChannel becomes easy to use like with QWebkit (Qtwebkit-bridge). Sending object from C++ to JS and JS to C++ was easy with a simple line of code once you did "addToJavaScriptWindowObject".

            Now you have to include QWebChannel.js, and do a bunch of other steps. I wish all theses steps could be automated and done under the hood by Qt using some flag on the QWebEngineView for example.
            That and also QWebEngine is harder to deploy compared to QWebKit, the QWebEngineView is not present in designer..etc. all that makes me stick for QWebKit for now...


            Free Indoor Cycling Software - https://maximumtrainer.com

            P 1 Reply Last reply Reply Quote 0
            • P
              pankaj4288 @maximus last edited by

              @maximus
              I am able to use Qwebchannel in a single windows application, where windows loads my local html pages and via QwebChannel i send some data to my c++ code

              J 1 Reply Last reply Reply Quote 0
              • J
                janalleman @pankaj4288 last edited by

                @pankaj4288
                Can you send data from c++ object back to html/js? If so, do you have suggestion on what should be done different in my question here ... with that code I an unable to get variables in html/js.

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