Hi All
what is now the recommended way to SetContextProperty in the main
function using the latest Sailfish application templates (from thp)?
The default main now looks like:
#include <sailfishapp.h>
int main(int argc, char *argv[])
{
return SailfishApp::main(argc, argv);
}
In the days of the old template and sailfishapplication I used to do
it this way:
#include "sailfishapplication.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication>
app(Sailfish::createApplication(argc, argv));
//New Sailfish Alpha 2 /Qt 5 way
//requires patch to sailfishapplication.cpp from Lucien Xu
QScopedPointer<QQuickView> view(Sailfish::createView());
view->rootContext()->setContextProperty("cppproperty", "Hello world");
Sailfish::setView(view.data(), "main.qml");
Sailfish::showView(view.data());
return app->exec();
}
Thanks
Chris
_______________________________________________
SailfishOS.org Devel mailing list