I was wondering exactly the same as Gabriel and Andrey's code solved my problem.
Thanks a lot, guys!!! ...Mariano Boragno... On Wed, Nov 13, 2013 at 12:25 PM, Andrey Kozhevnikov <coderusin...@gmail.com > wrote: > This is almost same what SailfishApp::main() does for you and it keeping > booster working, just lets you to use application and view instances > directly. > > Have fun with Sailfish ;) > > > On 13.11.2013 21:23, Gabriel Boehme wrote: > >> Wow, thanks to you and also Andrey! >> >> This is nearly the way I took back in the first Jolla Qt5 SDK, is it >> also the recommended way to do that? >> >> Will it have a (bad) influence on the start up times? >> >> Thanks so much! :) >> >> Hi, >>> >>> Yes your setContextProperty() to rootContext is the right approach. >>> Usually I do something like this: >>> >>> QScopedPointer<QGuiApplication> app(Sailfish::createApplication(argc, >>> argv)); >>> QScopedPointer<QQuickView> view(Sailfish::createView()); >>> MyClass data; >>> view->rootContext()->setContextProperty("myObject", &data); >>> Sailfish::setView(view.data(), "qrc:/main.qml"); >>> >>> ________________________________________ >>> From: devel-boun...@lists.sailfishos.org [devel-bounces@lists. >>> sailfishos.org] on behalf of Gabriel Boehme [m.gabrielboehme@googlemail. >>> com] >>> Sent: Wednesday, November 13, 2013 4:58 PM >>> To: Sailfish OS Developers >>> Subject: [SailfishDevel] How to use setContext() or what is recommended?! >>> >>> Hi sailors, >>> >>> in the very first (Qt4 version) of the SDK I ported an easy application, >>> that is using a list model. To connect the list model and also my main >>> logic stuff I used the setContextProperty() method. In the first Qt5 SDK >>> version I had to work a bit around that (created a view from >>> Sailfish::createView() and used the views >>> data().rootContext()->setContextProperty() methods. >>> >>> But now in the latest version I'm not quite sure about, how to do that? >>> >>> Or better: What is the recommended way to connect QML UI with C++ logic >>> and add a model for a view? I'm a bit confused, because coming from >>> Python/PySide I always used it that way with QDeclarativeView and get a >>> bit lost with Qt5 and QQuickView and QQuickApplication and all this >>> stuff, that changed also between 5.0 and 5.1, doesn't it? :-/ >>> >>> Would be great to get some advice! >>> >>> Thank you very much! >>> >>> _______________________________________________ >>> SailfishOS.org Devel mailing list >>> _______________________________________________ >>> SailfishOS.org Devel mailing list >>> >> >> _______________________________________________ >> SailfishOS.org Devel mailing list >> > > _______________________________________________ > SailfishOS.org Devel mailing list >
_______________________________________________ SailfishOS.org Devel mailing list