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

Quick Controls 2 styles extension



  • For example, consider Universal style.
    This is good, but not enough.
    Now, I have several problems with customization of my app:

    1. Ligth and dark themes looks good, but I want to change more colors than just accent, foreground and background. I see in source code that now in universal style exist 18 different colors, but they read only. It mean that in code I can use them in read only context, and next code:
    Universal.altHighColor: Universal.Red
    

    will return next error:

    Invalid property assignment: "altHighColor" is a read-only property
    
    1. Ok, may be I can extend universal themes and add own, where I will can redefine read only colors? No. I don't see real interfaces for this even in private classes.
    2. Once way that I see now is a copy paste Universal style, change colors to my needs and create own style, using private qt classes. Only for changing predefined colors.

    Really, styling in quick controls 2 looks very good as idea, but implementation now is very limited. May be I just don't understand something? How I can change predefined colors or add new theme for universal style?



  • It is all about the balance between performance and flexibility. The more configurable style attributes we add, the more information every single style node needs to store and inherit/promote, instead of being able to pick values straight from a shared table of pre-defined constants. The implementation is "very limited", as you say, by design. It is a deliberate choice to support a level of customization that keeps the performance optimal yet satisfies 90% of the users. For the 10% that need to go beyond that level, custom delegates, that allow you to do pretty much anything you want, is the recommended way to go.



  • Ok, may be this have sense, but what I can do now, if I satisfied with universal controls but want just to change colors? Is exist way excluding copy pasting universal style?


Log in to reply