Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Call a C++ function from HTML in QWebEngineView, Is it Possible ?
Forum Update on Monday, May 27th 2025

Call a C++ function from HTML in QWebEngineView, Is it Possible ?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 865 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
    Discode
    wrote on 4 Jul 2018, 03:36 last edited by
    #1

    Hello There
    I have a QWebEngineView to load a Web Page from local content.
    In that HTML page there is a Script include a variable "myVar", now i can get value of myVar but button click in C++,
    but my question is this:
    Is there any way to call a function in C++ whenever "myVar" changed ?
    something like this:

    <script>
            var myVar = null;
            function initVar(){
                   myVar = 'sample string';
                   // now call function ( funcInCpp(myVar);)
            }
    </script>
    

    Is there any way to do this ? if yes please help me
    Tnx

    R 1 Reply Last reply 4 Jul 2018, 06:34
    0
    • D Discode
      4 Jul 2018, 03:36

      Hello There
      I have a QWebEngineView to load a Web Page from local content.
      In that HTML page there is a Script include a variable "myVar", now i can get value of myVar but button click in C++,
      but my question is this:
      Is there any way to call a function in C++ whenever "myVar" changed ?
      something like this:

      <script>
              var myVar = null;
              function initVar(){
                     myVar = 'sample string';
                     // now call function ( funcInCpp(myVar);)
              }
      </script>
      

      Is there any way to do this ? if yes please help me
      Tnx

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 4 Jul 2018, 06:34 last edited by
      #2

      @Discode
      see QtWebChannel module

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3

      1/2

      4 Jul 2018, 03:36

      • Login

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