Hi,

A "global library" mechanism has been added for Qt Quick 2 (see 
http://bugreports.qt.nokia.com/browse/QTBUG-17318, and commit 
ae6c7a44394d4a5f943f1fc92f4de015ec7bcc96 in the qtquick2 branch). 

Regards,
Michael

On 17/04/2011, at 9:30 PM, ext Ville M. Vainio wrote:

> Dear sirs/madams,
> 
> It would be useful to have a global object (or a pattern that provides
> such without being too verbose).
> 
> Let's say I want to refer to "theme" property (a javascript Object),
> by using phrase like "global.theme". I can accomplish this in varying
> ways, including (but not limited to)
> 
> 1) setting it from C++ side by setContextProperty
> 2) having an object up in parent hierarchy
> ('mainview.theme.defaultTextSize') that I just "know" to be there in
> all my .qml files (which is what I do now, but it's messy).
> 3) storing the global object in .js file with .pragma library. Messy
> as well, need extra import, .js needs to be bundled in certain
> directory, no property binding, etc.
> 
> Any other patterns I missed? Or is this something the framework will
> address eventually?
> _______________________________________________
> Qt-qml mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to