[Development] QML Rectangle corner radius API for Qt 6.7

Pierre-Yves Siret py.siret at gmail.com
Fri Dec 22 17:08:15 CET 2023


Le ven. 22 déc. 2023 à 14:19, André Somers <andre at familiesomers.nl> a
écrit :

> The point I wanted to raise was that having four separate properties isn't
> ideal, and that we could give ourselves a lot of room for improvement by
> having a `corners` grouped property that can contain more than just a
> single real value for a radius.
>

I think that's a valid point but the alternatives are not worth it.
The anchors grouped property is nice to use and it has 17 sub-properties
that make sense and sensible names.

I wouldn't want a radii grouped property just because of its name.
I much prefer writing topLeftRadius: 10 than radii.topLeft: 10.
The pedantic latin syntax doesn't help with the readability. Maybe that's
just because I am not a native English speaker.

Changing radius to be grouped is not possible due to backward
compatibility, and I am not even sure it would be a reasonable API break
for Qt 7.

You mentioned a corners grouped property. What would be the syntax?
corners.topLeft: 10 ? This isn't descriptive enough.
corners.topLeft.radius: 10 ? That's a bit of a mouthful.
It realistically won't have other properties than radius. Specifying a
color for each corner seems very niche. Having the ability to change the
color of a side seems more useful and we don't even have that, not that it
is a big deal.
Do you have other properties in mind?
Mike's suggestion on LinkedIn about bevels is more sensible but has he said
it's a bit of a feature creep.
After a quick look, I don't see any feature requests for additional corner
properties in Jira.

The issue reported by Kai is worth fixing though.

Using BorderImage or implementing your own custom Rectangle if you want
more control seems to be better than overly complexifying the Rectangle API.

Pierre-Yves
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231222/f1c4ac74/attachment.htm>


More information about the Development mailing list