Commit 27688270 authored by Marco Bubke's avatar Marco Bubke Committed by Kai Koehne
Browse files

Load plugins at the beginning of the meta info initializing

Reviewed-by: kkoehne
parent 3330d159
......@@ -68,6 +68,7 @@ public:
void clear();
void initialize();
void loadPlugins(QDeclarativeEngine *engine);
void parseQmlTypes();
void parseNonQmlTypes();
void parseValueTypes();
......@@ -112,6 +113,7 @@ void MetaInfoPrivate::initialize()
QDeclarativeEngine engine;
Q_UNUSED(engine);
loadPlugins(&engine);
parseQmlTypes();
parseNonQmlTypes();
parseValueTypes();
......@@ -120,7 +122,25 @@ void MetaInfoPrivate::initialize()
m_isInitialized = true;
}
void MetaInfoPrivate::loadPlugins(QDeclarativeEngine *engine)
{
// hack to load plugins
QDeclarativeComponent pluginComponent(engine);
QStringList pluginList;
pluginList += "import Qt 4.7";
pluginList += "import org.webkit 1.0";
// load maybe useful plugins
pluginList += "import Qt.labs.folderlistmodel 1.0";
pluginList += "import Qt.labs.gestures 1.0";
pluginList += "import Qt.multimedia 4.7";
pluginList += "import Qt.labs.particles 1.0";
QString componentString = QString("%1\n Item {}\n").arg(pluginList.join("\n"));
pluginComponent.setData(componentString.toLatin1(), QUrl());
}
void MetaInfoPrivate::parseProperties(NodeMetaInfo &nodeMetaInfo, const QMetaObject *qMetaObject) const
{
......
......@@ -3606,6 +3606,12 @@ void TestCore::testMetaInfo()
{
QScopedPointer<Model> model(Model::create("Qt/Item"));
QVERIFY(model.data());
// test whether default type is registered
QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Item", 4, 7));
// test whether types from plugins are loaded
QVERIFY(model->metaInfo().hasNodeMetaInfo("org.webkit/WebView", 1, 0));
}
void TestCore::testMetaInfoSimpleType()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment