Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. New C++-JS-Types with constructor for QML's QtScript
QtWS25 Last Chance

New C++-JS-Types with constructor for QML's QtScript

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.9k 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.
  • M Offline
    M Offline
    manuelsch
    wrote on last edited by
    #1

    Hi,

    for QScriptEngines it is possible to create C++ functions that you can use as constructors in javascript using @QScriptEngine::newFunction ( FunctionSignature fun, const QScriptValue & prototype, int length = 0 )@
    and then you can call
    @ var myObj = new CPPConstructor() @

    Is it possible to do the same for QML?
    QDeclarativeEngine just allows you to create new QML types, but I don't see how to add new javascript types.

    Cheers,

    Manuel

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      Hi,

      Unfortunately this isn't currently possible. http://bugreports.qt.nokia.com/browse/QTBUG-11942 is probably the most relevant suggestion to track in regards to this.

      Regards,
      Michael

      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