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. Expose enum to QScriptEngine
Forum Updated to NodeBB v4.3 + New Features

Expose enum to QScriptEngine

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.0k 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.
  • M Offline
    M Offline
    mirswith
    wrote on 14 Oct 2011, 19:23 last edited by
    #1

    I've searched the docs and google but am unable to find an example of how this is done. I am exposing the ability to create new a new object like this:

    @
    QScriptValue ctor = _scriptEngine->newFunction(ScriptFile::createNew);
    v = _scriptEngine->newQMetaObject(&QObject::staticMetaObject, ctor);
    _scriptEngine->globalObject().setProperty("File", v);
    @

    And I found this "Values for enums declared with Q_ENUMS are not available as properties of individual wrapper objects; rather, they are properties of the QMetaObject wrapper object that can be created with QScriptEngine::newQMetaObject()." "here":http://doc.qt.nokia.com/latest/scripting.html#enum-values

    But I am still unsure how to do it. Lets say my "File" object has the enum File::Count with values File::ONE and File::TWO, how would I go about exposing those?

    Thanks.

    1 Reply Last reply
    0

    1/1

    14 Oct 2011, 19:23

    • 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