Setup KDeclarative before loading the Qml file

Otherwise methods injected into the engine by KDeclarative are not
available in the loaded qml.

REVIEW: 124419
This commit is contained in:
Martin Gräßlin 2015-09-07 17:42:19 +02:00 committed by Aleix Pol
parent e462c386cf
commit cc148cea89

View file

@ -39,11 +39,13 @@ int main(int argc, char *argv[])
aboutData.processCommandLine(&parser); aboutData.processCommandLine(&parser);
} }
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); QQmlApplicationEngine engine;
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(&engine); kdeclarative.setDeclarativeEngine(&engine);
kdeclarative.setupBindings(); kdeclarative.setupBindings();
engine.load(QUrl("qrc:/qml/main.qml"));
return app.exec(); return app.exec();
} }