[Interest] QMake commands, QML preprocessing
Bo Thorsen
bo at fioniasoftware.dk
Mon Feb 13 15:43:31 CET 2012
Den 13-02-2012 15:19, Harri Pasanen skrev:
> Hi,
>
> I'm wondering what would be the recommended way to pre-process QML?
>
> # Add more folders to ship with the application, here
> folder_01.source = qml/n9test
> folder_01.target = qml
> DEPLOYMENTFOLDERS = folder_01
>
> At deployment time I'd like to change the QML, but keep the unchanged copy
> in version control.
>
> There are some hooks for adding preprocessing for C++, but does
> something equivalent exist for QML?
>
> In this particular case I would like to have VERSION variable as
> a macro inside QML, so that it would automatically expand to the same
> as defined in .pro, rather than having to edit in manually.
I don't think you can do this. Instead of doing this, you can define
this for the C++ code and set a context property.
viewer->rootContext()->setContextProperty("VERSION", VERSION_DEFINED);
I can see that running something on a source folder file could be
useful. However, running a preprocessor over the QML files sounds like a
bad idea to me. The old "when the only tool you have is a hammer, all
problems are nails" come to mind :-)
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Interest
mailing list