[Interest] Qt 5.7 - Using File Selectors with Qt Quick Controls 2

Nikita Krupenko krnekit at gmail.com
Sun May 8 13:50:29 CEST 2016


2016-05-08 13:59 GMT+03:00 ekke <ekke at ekkes-corner.org>:
> what if (per ex. for a demo app) user can switch between universal and
> material and using some images specific to universal, others to material and
> this in combination with ios and android - is this possible via file
> selector or will it only work for one style per platform.

You can place style-specific images into separate folders and if you
have some different images in style for os you can check
Qt.platform.os and select the appropriate image:
https://doc.qt.io/qt-5/qml-qtqml-qt.html#platform-prop
For example, you have:

+material/img_ios.png
+material/img_android.png

Image {
    source: Qt.platform.os === "ios" ? "img_ios.png" : "img_android.png"
}

It depends on what part you share and what is specific. It could be
the other way, that you have mostly identical resources for different
styles, but all highly os-specific. Then you can place it in
os-specific folder and in some cases select proper image for current
style using ?: expression.

> as Google does this for Material icons: android
> versions getting _black for light theme and _white for dark theme

In most cases you need white icons for the app bar and other icons are
tinted with some color, so you can just use white icons :)



More information about the Interest mailing list