[SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sun Aug 4 12:09:07 UTC 2013

Hi all

What is the recommended way to pass simple c++ properties from the  
main.cpp to the QML part of a project using the Qt 5 Alpha?

In the good old days of the first Alpha, I used to do this Harmattan  
style using

     QmlApplicationViewer viewer;
     viewer.rootContext()->setContextProperty("platform",  platformId);

This would make the c++ property platformId available to my qml code  
as the property platform.

Now with Qt5 / Alpha 2 the QmlApplicationViewer is no longer created.

The tutorial linked below suggests that the QmlApplicationViewer files  
could be ported to Qt5, so I guess I could grab these files from an  
old Harmattan project and do that.


But somehow that feels like carting old baggage around.

Is their a Sailfish native way of doing the same?



More information about the Devel mailing list