Fix loading of JS plugins
This commit is contained in:
parent
493b211eec
commit
8274550eed
@ -81,7 +81,7 @@ bool ScriptIntegrationPlugin::loadScript(const QString &fileName)
|
|||||||
dbg << spacer << "^";
|
dbg << spacer << "^";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_metaData = QJsonObject::fromVariantMap(jsonDoc.toVariant().toMap());
|
setMetaData(QJsonObject::fromVariantMap(jsonDoc.toVariant().toMap()));
|
||||||
|
|
||||||
m_engine = new QQmlEngine(this);
|
m_engine = new QQmlEngine(this);
|
||||||
m_engine->installExtensions(QJSEngine::AllExtensions);
|
m_engine->installExtensions(QJSEngine::AllExtensions);
|
||||||
@ -98,11 +98,6 @@ bool ScriptIntegrationPlugin::loadScript(const QString &fileName)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject ScriptIntegrationPlugin::metaData() const
|
|
||||||
{
|
|
||||||
return m_metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptIntegrationPlugin::init()
|
void ScriptIntegrationPlugin::init()
|
||||||
{
|
{
|
||||||
//Couldn't find an non-qml way to register abstract classes in the JS engine as qRegisterMetatype doesn't deal so well with abstract classes
|
//Couldn't find an non-qml way to register abstract classes in the JS engine as qRegisterMetatype doesn't deal so well with abstract classes
|
||||||
|
|||||||
@ -171,7 +171,6 @@ public:
|
|||||||
explicit ScriptIntegrationPlugin(QObject *parent = nullptr);
|
explicit ScriptIntegrationPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
bool loadScript(const QString &fileName);
|
bool loadScript(const QString &fileName);
|
||||||
QJsonObject metaData() const;
|
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
void startMonitoringAutoThings() override;
|
void startMonitoringAutoThings() override;
|
||||||
@ -185,7 +184,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QQmlEngine *m_engine = nullptr;
|
QQmlEngine *m_engine = nullptr;
|
||||||
QJsonObject m_metaData;
|
|
||||||
QJSValue m_pluginImport;
|
QJSValue m_pluginImport;
|
||||||
QHash<Thing*, ScriptThing*> m_things;
|
QHash<Thing*, ScriptThing*> m_things;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user