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. QJSEngine and C++ classes instanciated from JavaScript
Forum Update on Monday, May 27th 2025

QJSEngine and C++ classes instanciated from JavaScript

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 657 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.
  • N Offline
    N Offline
    NicoWallmeier
    wrote on 8 Aug 2014, 14:27 last edited by
    #1

    Hello,

    with the old QtScript it was possible to define a JavaScript class which is based on a C++ class.

    The code for this purpose on C++ was
    @
    QScriptValue ctor = engine->newFunction(constructor);
    QScriptValue myScriptClass = engine->newQMetaObject(&QObject::staticMetaObject, ctor);
    engine.globalObject().setProperty("MyClass", myScriptClass);
    @

    Then it was possible to write in JavaScript
    @var x = new MyClass();@

    How can this be achieved with the new QJSEngine?

    Best regards,
    Nico

    1 Reply Last reply
    1

    1/1

    8 Aug 2014, 14:27

    • 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