Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Change javascript variable from Qt
Forum Updated to NodeBB v4.3 + New Features

Change javascript variable from Qt

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 1.1k 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
    sagar.vekariya
    wrote on last edited by
    #1

    hello everyone,
    I am new to QT .I want to know that how can I change javascript variable from Qt.

    suppose in JAVASCRIPT.js one variable is var name="sagar";
    now I want to change that javascript variable called name with new name "john" .

    So please let me know how to do that.

    1 Reply Last reply
    0
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

      There is no context for answer to your question.
      Please, give us more details about the context, where and when you want to change the variable... otherwise the only answer can be:
      "just do it" :-)

      @name = "john";@

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sagar.vekariya
        wrote on last edited by
        #3

        In javascript.js file contains :
        var ItemName="coldrinks";
        var ItemValue="100";
        function myfunction()
        {
        document.getElementById('nItemValue')[removed]=ItemValue;
        document.getElementById('nItemName')[removed]=ItemName;
        }

        In my Qt program;

        QString nItemName ="potato chips";
        QString nItemPrice = 20;

        QUrl iUrl=Url::fromLocalFile((QDir::current().absoluteFilePath("./html_pages/alert_item_recognized.html")));
        ui->webView->settings()->clearMemoryCaches();
        ui->webView->load(iUrl);
        ui->webView->show();

        I want to just know any method for edit javascript file before alert_item_recognized.html opened. I want to edit contents of javascript.js..

        before html page loads javascript file should edit with
        var ItemName="potato chips";
        var ItemValue="20";

        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