[SailfishDevel] best way to set QML properties from within C++ in Sailfish?

Wim de Vries wsvries at xs4all.nl
Thu Dec 12 12:42:24 UTC 2013


Hi,
I need to set many properties in QML elements from within C++.
QT documentation:

QQmlEngine  <http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html>  engine;
QQmlComponent  <http://qt-project.org/doc/qt-5.0/qtqml/qqmlcomponent.html>  component(&engine,  "MyItem.qml");
QObject  <http://qt-project.org/doc/qt-5.0/qtcore/qobject.html>  *object=  component.create();
qDebug  <http://qt-project.org/doc/qt-5.0/qtcore/qtglobal.html#qDebug>()<<  "Property value:"  <<  QQmlProperty  <http://qt-project.org/doc/qt-5.0/qtqml/qqmlproperty.html>::read(object,  "someNumber").toInt();
QQmlProperty  <http://qt-project.org/doc/qt-5.0/qtqml/qqmlproperty.html>::write(object,  "someNumber",  5000)


Still in Sailfish we only have a QQuickView*, no QQmlEngine/QQmlComponent.
How do I get their from QQuickView?

Also,
Can I get to all Pages (even if not active) and their nested childs via 
the above mentioned QObject*  ?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131212/7088a115/attachment.html>


More information about the Devel mailing list