[Qt-qml] env variable expansion in import, useful for styles?

Matthias Ettrich matthias.ettrich at nokia.com
Mon Apr 26 15:18:49 CEST 2010


Hi,

attached is a small patch which adds environment variable expansion to the 
import statement. Rationale: this might be useful to implement different 
(native) component styles.

You could make a module:

com.mycompany.qml-ui-components

which contains a C++ plugin and a bunch of files, e.g. Button.qml

The Button.qml itself reads only:

-----------Button.qml-----------
import "$STYLE"
Button{}
--------------------------------

and you have subdirectories like:

 plain/Button.qml
 fancy/Button.qml
 crazy/Button.qml

The C++ plugin is responsible for setting the correct default style (using 
::qputenv()) on the current platform, if not set otherwise.

Currently you can only achive this when playing with the module imports path, 
the patch would make this easier.

Reasonable extension?

Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: expand_variables.patch
Type: text/x-patch
Size: 1594 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100426/dda83fea/attachment.bin 


More information about the Qt-qml mailing list