On 13/01/14 23:01, Marcel wrote: > Hi all, > > Sorry to be slightly offtoppic, but a small question on this: what would be > the best practice then if I would need the position in QML and in C++, or in > two different pages in QML? Shouldn't I use two PositionSources? I have this > problem for my app if I want to show the position in the app cover...
If you have an object which is an information source like this then I declare it as an object in QML: int main(int argc, char *argv[]) { QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv)); QScopedPointer<QQuickView> view(SailfishApp::createView()); PositionSource* ps = new PositionSource; view->rootContext()->setContextProperty("PositionSource", ps); view->setSource(SailfishApp::pathTo("qml/main.qml")); view->show(); return app->exec(); } Now any of your QML pages/covers/objects can access PositionSource.slot() or PositionSource.property (see Q_PROPERTY ) or connect to PositionSource.signal()s David _______________________________________________ SailfishOS.org Devel mailing list