<p dir="ltr">Also, there is<br>
<a href="http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#qmlRegisterSingletonType">qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#qmlRegisterSingletonType</a><br>
</p>
<div class="gmail_quote">On Aug 4, 2013 3:31 PM, "Martin Grimme" <<a href="mailto:martin.grimme@gmail.com">martin.grimme@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
you don't want to set the context property on the<br>
QmlApplicationViewer, which was dead Nokia code to target Symbian and<br>
Harmattan, anyway.<br>
QmlApplicationViewer was derived from QmlView, where it got the<br>
rootContext() method from.<br>
<br>
With Qt5, QmlView was renamed to QQuickView. And when using the<br>
functions from sailfishapplication.h, you get a QQuickView*, e.g.:<br>
<br>
        QScopedPointer<QQuickView> view(Sailfish::createView("main.qml"));<br>
        view->rootContext()->setContextProperty("platform", platformId);<br>
<br>
<br>
Martin<br>
<br>
<br>
2013/8/4, <a href="mailto:christopher.lamb@thurweb.ch">christopher.lamb@thurweb.ch</a> <<a href="mailto:christopher.lamb@thurweb.ch">christopher.lamb@thurweb.ch</a>>:<br>
> Hi all<br>
><br>
> What is the recommended way to pass simple c++ properties from the<br>
> main.cpp to the QML part of a project using the Qt 5 Alpha?<br>
><br>
> In the good old days of the first Alpha, I used to do this Harmattan<br>
> style using<br>
><br>
>      QmlApplicationViewer viewer;<br>
>      viewer.rootContext()->setContextProperty("platform",  platformId);<br>
><br>
> This would make the c++ property platformId available to my qml code<br>
> as the property platform.<br>
><br>
> Now with Qt5 / Alpha 2 the QmlApplicationViewer is no longer created.<br>
><br>
> The tutorial linked below suggests that the QmlApplicationViewer files<br>
> could be ported to Qt5, so I guess I could grab these files from an<br>
> old Harmattan project and do that.<br>
><br>
> <a href="https://qt-project.org/doc/qt-5.0/qtdoc/portingqmlapp.html" target="_blank">https://qt-project.org/doc/qt-5.0/qtdoc/portingqmlapp.html</a><br>
><br>
> But somehow that feels like carting old baggage around.<br>
><br>
> Is their a Sailfish native way of doing the same?<br>
><br>
> Thanks<br>
><br>
> Chris<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> SailfishOS.org Devel mailing list<br>
><br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
</blockquote></div>