Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Expose enum to QScriptEngine
mirswith last edited by
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);
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?