[SailfishDevel] How to use setContext() or what is recommended?!

Gabriel Boehme m.gabrielboehme at googlemail.com
Wed Nov 13 14:58:32 UTC 2013


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!



More information about the Devel mailing list