Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to customize app-wide theme



  • As a QStyle and CSS thinker, I am having trouble understanding how to manage app-wide theme settings in Qml. It appears that there is a list of available themes, but no canonical guide for how to, for example, change the normal text size or window color or table element height for every element in my app?

    It seems strange that you would hard-code a particular theme into an app because then you couldn't swap the theme out and have it propagate across the app. For example with the following example from the Qt docs:

    Button {
        text: qsTr("Button")
        highlighted: true
        Universal.accent: Universal.Orange
    }
    

    Do you program all of your items and delegates to pull from some global variables, and then set the globals to specific theme attributes?

    Is it typical practices to simply hard-code a single look and feel across devices?

    Am I not thinking about this correctly? What am I missing?

    Cheers,
    -Patrick



  • You should set theme to ApplicationWindow, all child controls inherits theme from parent items.



  • @IntruderExcluder How would this work if this is a QWidget app that only uses QQuickWidget as sub-views, e.g. for property sheets?


Log in to reply