[Interest] [Qt Labs Controls 5.6] Customization recommendations
Nurmi J-P
jpnurmi at theqtcompany.com
Sat Mar 12 08:34:53 CET 2016
On 2016-03-11 16:42, Ronan Jouchet wrote:
>> 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.
For the time being, you would either have to
- create extended types and use a local import folder (myapp/mycontrols/Button.qml => import "mycontrols" as My => My.Button { } => creates an instance of myapp/mycontrols/Button.qml), or
- create your own QTDIR/qml/Qt/labs/controls/<style> folder where you can place Button.qml. With this approach any missing QML file will currently fallback to the Default style instead of the Material style, though.
Currently there is no way to configure the system to load styles from anywhere else than QTDIR/qml/Qt/labs/controls/<style>. In addition to the current options (command line arg, environment variable, configuration file), we have plans to introduce C++ API for specifying the style name. I have added a note to https://bugreports.qt.io/browse/QTBUG-50787 that we might want to make the style path (and possibly the fallback style) also configurable.
> 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
The project is under heavy development and we're constantly looking for ways to improve use cases that are important to our users. We wanted to release the unfinished project as a technology preview to get some early feedback to better understand your needs. Don't hesitate the file in any suggestions you might have, we're eager to hear all kinds of ideas. :)
Currently the only configurable style-specific attributes are theme and accent (Material & Univeral), and primary color (Material only). A foreground/text color sounds like a good candidate to be exposed as a writable style-attribute.
--
J-P Nurmi
More information about the Interest
mailing list