Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 3 files). Show all
Unified · Split
| @@ -827,6 +827,19 @@ void ScriptEngine::init() { · 826 unmodified lines | |||
| 827 | })); | 827 | })); |
| 828 | } | 828 | } |
| 829 | 829 | ||
| 830 | void ScriptEngine::registerEnum(const QString& enumName, QMetaEnum newEnum) { | ||
| 831 | if (!newEnum.isValid()) { | ||
| 832 | qCCritical(scriptengine) << "registerEnum called on invalid enum with name " << enumName; | ||
| 833 | return; | ||
| 834 | } | ||
| 835 | |||
| 836 | for(int i=0;i<newEnum.keyCount();i++) { | ||
| 837 | const char *keyName = newEnum.key(i); | ||
| 838 | QString fullName = enumName + "." + keyName; | ||
| 839 | registerValue(fullName, newEnum.keyToValue(keyName)); | ||
| 840 | } | ||
| 841 | } | ||
| 842 | |||
| 830 | void ScriptEngine::registerValue(const QString& valueName, QScriptValue value) { | 843 | void ScriptEngine::registerValue(const QString& valueName, QScriptValue value) { |
| 831 | if (QThread::currentThread() != thread()) { | 844 | if (QThread::currentThread() != thread()) { |
| 832 | #ifdef THREAD_DEBUGGING | 845 | #ifdef THREAD_DEBUGGING |