Dialogs for QJSEngine has been fixed. Child objects registration has been added

This commit is contained in:
Arin Alexander 2016-11-04 21:42:15 +03:00
parent cf1b2a4146
commit 97c1eb3f77

View File

@ -293,11 +293,24 @@ void ReportRender::initVariables()
}
#ifdef HAVE_UI_LOADER
#ifdef USE_QJSENGINE
void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){
foreach(QObject* obj, sv->toQObject()->children()){
ScriptValueType child = se->newQObject(obj);
sv->setProperty(obj->objectName(),child);
registerChildObjects(se, &child);
}
}
#endif
void ReportRender::initDialogs(){
if (m_scriptEngineContext){
ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine();
foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){
ScriptValueType sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name()));
#ifdef USE_QJSENGINE
registerChildObjects(se,&sv);
#endif
se->globalObject().setProperty(dialog->name(),sv);
}
}