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. Exposing C++ list of objects to Scripting (QJSEngine)

Exposing C++ list of objects to Scripting (QJSEngine)

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 771 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.
  • B Offline
    B Offline
    Buggy
    wrote on 2 Jul 2013, 07:37 last edited by
    #1

    Hello,

    I am trying to expose a list of C++ objects to Scripting. To keep it simple, lets say I want to have a list of files.

    desired Script code:
    @var filelist = getFileList()
    for(var onefile in filelist)
    {
    myPrintFunction(onefile.size)
    }
    @

    1) Is this possible (how?) and are there any examples around? I searched my head off but did not succeed.

    I have succeeded in exposing singular QFiles to script by wrapping them in a QObject based "MyFile"-class and brokering between MyFile and the real wrapped QFile through Q_INVOKABLE and Q_PROPERTY.

    2) Can this be done using the new QJSEngine?

    The second question is: is this possible via QJSEngine (not the old QtScript QScriptEngine engine but the new v8-based one that is used in QML, faster and guaranteed to stay around) - and is it a good idea to settle for QJSEngine in favor of QScriptEngine?

    1 Reply Last reply
    0

    1/1

    2 Jul 2013, 07:37

    • 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