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

Change control type styling via qtquickcontrols2-configuration?



  • Can I use the qtquickcontrols2.conf file to globally style controls such as Buttons and Labels?

    For example can I do something like the following?

    [Controls]
    Style=Material
    
    [Material]
    Theme=Dark
    
    [Material\Button]
    Text=Red
    
    [Material\Label]
    Color=Red
    

    The above isn't working for me. I am aware I can use the Style Singleton approach but that means I need to use the style variables in each QML document I make. It would be nicer to just change it globally something like the above if its possible.

    Also: Certain configuration settings are not working. For example, the palette changes dont work but font changes do. Any idea why?

    [Controls]
    Style=Material
    
    [Material]
    Theme=Dark ; These changes work
    Accent=Red
    Palette.Base=Red  ; These changes are not applied/shown?
    Palette.Text=Blue
    
    ; These changes are applied/shown
    [Material\Font]
    Family=Open Sans
    PixelSize=20
    
    ; These changes are not applied/shown?
    [Material\Palette]
    Base=#000000
    Text=#ffffff

Log in to reply