how do you use QML to changing skins(themes)



  • Hello, everyone!
    I want to use QML for skin change,widgets + qss are easy to implement,but I'm not sure what to do with QML. who can tell me how to do it, thanks



  • Hello! AFAIK, you can create global variables for each element value of your 'appskin' you want to change (width, height, background color/image, etc) for each element ( like button, listview, etc.). The next step is to set values of your elements as they are set in 'global variables', eg:
    Button {
    id: awesomeButton;
    width: yourVarForAwesomeButtonWidth;
    }
    , or something like that. And, the last step is to create a method, which changes global variables, eg load values from 'application skin file' or smth like that. And when you want to change app skin you just call this method with skin name/skinFilePath as a param. And, ofc, don't forget to check values from external skin file for validity. That's all. Hope in helps.



  • Hi,

    Maybe you can try the CSS approach implemented here : https://github.com/Ableton/aqt-stylesheets

    See video here : https://www.youtube.com/watch?v=O5GJCyBOuCY


Log in to reply
 

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