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

Wim de Vries wsvries at xs4all.nl
Thu Dec 12 14:33:46 UTC 2013


On 12/12/2013 02:39 PM, Robin Burchell wrote:
> 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.
Why is the Qt preferred way deprecated in Sailfish?

QQmlProperty  <http://qt-project.org/doc/qt-5.0/qtqml/qqmlproperty.html>::write(object,  "someNumber",  5000)


So much simpler and understandable.



>
>
> _______________________________________________
> SailfishOS.org Devel mailing list

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


More information about the Devel mailing list