Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to import JS file into QJSEngine?
Forum Updated to NodeBB v4.3 + New Features

How to import JS file into QJSEngine?

Scheduled Pinned Locked Moved General and Desktop
qt quickqmljavascript
1 Posts 1 Posters 897 Views 2 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.
  • K Offline
    K Offline
    Korchkidu
    wrote on 2 Jul 2015, 17:21 last edited by
    #1

    Hi,

    I have a QML / C++ application which embeds a QJSEngine. For the GUI, I created JS files containing JS functions that QML components import and call.

    // My QML Component
    import "../JS/Utility.js" as Utility
    [...]
    var result = Utility.myFunction()
    

    Now, I would lile to expose this to the QJSEngine too. Is this possible? I tried using the import statement in my JS scripts and use the QJSEngine::evaluate function but it seems this does not work (or I did something wrong).

    Thanks for any help.
    Best regards.

    1 Reply Last reply
    0

    1/1

    2 Jul 2015, 17:21

    • Login

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