[SOLVED] Is exist fututre plans for supproting tech like qss in qml?



  • Hi all!

    I interested in this because I don't understand how I can create several designs for several platforms in my app.
    I don't want to create several projects for each platform, I want to load predefined design in compilation time.
    And also I don't want create different qml files.

    I already read this topic "http://qt-project.org/wiki/QmlStyling":http://qt-project.org/wiki/QmlStyling , but this not provide what I need because I don't can change singleton qml file in compilation time.

    Is exist any ways or is will be?

    Thank you for your attention!



  • There are two mechanisms that you can already make use of to do this.
    As for your style, I would suggest you create multiple versions of a file called something like Constants.qml, containing properties like marginWidth, titleColor, baseColor, buttonPixmap etc.

    Then you can load this into your application on a per-platform basis, by either creating a loader:

    @
    Loader {
    source: switch(Qt.platform.os) {
    case "android: ...
    case "windows: ...
    }
    @
    etc

    Or alternatively, with Qt 5.2 there are new platform selectors that allows ou to build multiple versions of your application with specific file names/directories for different platforms:

    http://qt-project.org/doc/qt-5/qqmlfileselector.html



  • Thank you very much!

    This is better solutions from this that I saw before!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.