[Interest] [Qt Labs Controls 5.6] Customization recommendations

Ronan Jouchet ronan.jouchet at cadensimaging.com
Fri Mar 11 16:42:08 CET 2016


On 2016-03-10 19:09, Nikita Krupenko wrote:
> 2016-03-10 17:19 GMT+02:00 Ronan Jouchet <ronan.jouchet at cadensimaging.com>:
>>    -> That sounds nice for users wanting total control over the complete
>>       style. But suppose instead I'm mostly happy with Material and
>>       only want to *override some attributes*, much like I would do
>>       with CSS in a webapp, and as opposed to wholly defining control
>>       sub-items {label, background, ...}.
>>
>>       Is there a way to do that? Following the documentation sentence
>>       quoted above, I'd just copy the whole `material` folder and start
>>       tweaking, but then I'd have to merge my tweaks with upstream
>>       changes brought by each Qt release.
>>       Correct? Is this the workflow you have in mind?
>
> You don't need to copy anything, you can just use button with Material
> theme and override it's background or label. You can also tweak some
> properties, like font or padding, that is used for creating and
> positioning default background and label.

Hi. Two things:

1. Sure, that works for a one-time, isolated tweak. But I'm talking
    about tweaking *all* instances of a control. Thus the need to
    "overlay" or fork my own variant of Material.

2. Even in the case of  a one-time change, remains the question of the
    granularity of tweaks. Suppose I have a checkbox for which I want a
    green-colored label. Is there a way to only override the color
    property like I could with CSS?

    I am totally able to wholly re-define the `label` property:
    label: Text {
       // dozens of attributes I don't want to touch but have to
       // copy-paste from the reference Material implementation
       color: "green"
    }

    Whereas I would like to simply
    // fails and logs `Cannot assign to non-existent property "color"`
    label.color: "green"

    So in this case I could `property alias labelColor: label.color`
    and later on set `labelColor: "green"`
    ... but the alias would have to be in the source CheckBox
    implementation, and I'm back at modifying Material, which was what
    I wanted to avoid initially.

    Am I missing something? More generally I created
    https://bugreports.qt.io/browse/QTBUG-51785

> Also, note, that Qt Labs Controls is a TP in 5.6. The label already
> became contentItem in 5.7.

Yup, no problem with that, the documentation and "labs" namespace are 
pretty clear that the API isn't stable.

>> 3. With upcoming desktop support in mind, would it be interesting to
>>    add a third customization axis (alongside theme & accent) called
>>    "density" that would adjust paddings like the [GMAIL] feature does?
>
> There is opened BR: https://bugreports.qt.io/browse/QTBUG-51109

Thanks! Keeping an eye on this one.



More information about the Interest mailing list