[SailfishDevel] best way to set QML properties from within C++ in Sailfish?
Robin Burchell
robin.burchell at jolla.com
Thu Dec 12 13:39:51 UTC 2013
On 12 Dec 2013, at 14:28, Wim de Vries <wsvries at xs4all.nl<mailto:wsvries at xs4all.nl>> wrote:
I need to set many properties in QML elements from within C++.
You may find it easier to expose these properties *from* C++ to QML, using a singleton type (for example)
http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html#registering-singleton-objects-with-a-singleton-type
Yes, I have to control many property values.
I’m not sure how that matters.. see: http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#qmlRegisterSingletonType-2
You can register your object instance as a singleton, exposing as many properties/methods as you like - there’s no limitations and it’s fairly easily done
Theme properties in Silica are exposed through a singleton, for example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131212/5fda5e49/attachment.html>
More information about the Devel
mailing list