[Development] Platform Content Selection
Alberto Mardegan
mardy at users.sourceforge.net
Tue Jan 8 12:17:11 CET 2013
On 01/08/2013 02:03 AM, Alan Alpert wrote:
> Feedback?
>
> It's really Qt that's cross-platform focused now, not me. I just want
> this so that SameGame runs beautifully on BB10 :) . So while I'd
> welcome feedback from any source, I *need* to hear it from people
> interested in other platforms (or even just cross-platform
> development!).
As Attila wrote, platform content selection is already possible with the
resource system (and I think it can easily be achieved with external QML
files as well) by selecting the import paths based on the platform. This
already works for me:
===============
contains(MEEGO_EDITION,harmattan) {
# Harmattan UI overrides
RESOURCES += ../qml/harmattan.qrc
DEFINES += MEEGO
} else {
maemo5 {
RESOURCES += ../qml/maemo.qrc
DEFINES += MAEMO5
} else {
# Desktop
RESOURCES += ../qml/desktop.qrc
}
}
===============
It seems to me that this is a problem which can/should be solved at the
build system level. Also, this can be used to address another concern
you mentioned in your blog post, about the performance of the
calculations required for resolution independence: you could have a
preprocessor for QML files that works like this:
qml-defs-processor -defs constants-bb10.js input.qml > output.qml
which would load the constants-bb10.js file and substitute them in the
input.qml file, also performing basic math operations; so, if your
input.qml is:
===============
Item {
width: 4 * mm
}
===============
and constants-bb10.js is:
===============
mm = 4.5
===============
you would get the following output.qml:
===============
Item {
width: 18
}
===============
A similar tool could be produced to expand Ubuntu's units.mm(4)
functions into the final value.
And why not, to "compress" the QML file and remove all whitespaces :-)
Ciao,
Alberto
More information about the Development
mailing list