[Development] QML Rectangle corner radius API for Qt 6.7

André Somers andre at familiesomers.nl
Fri Dec 22 11:15:52 CET 2023


Hi,

Starting from 6.7 we'll have separate corner radii for the corners of a 
Rectangle. Nice, very welcome!

https://doc-snapshots.qt.io/qt6-6.7/qml-qtquick-rectangle.html

Unfortunately, the API looks a bit clunky and not ready for further 
extension. Would it not be better to use a grouped property here instead 
of having four different properties?

I can see two options. The simplest option is to have a `radii` 
property, which is a grouped property containing the `topLeft`, 
`topRight`, `bottomLeft` and `bottomRight` properties as a floating 
point value as we have now. I think that would be cleaner than the 
current state of things.

The second option is to actually allow for some more customization, and 
have a `corners` property, where each corner again is named as in the 
`radii` above, but would itself be a grouped property that could not 
only contain `radius` but also `color` (and perhaps other properties in 
the future*). Setting different colors for each of the corners would 
allow for way more flexible gradients than what we have at the moment.

Cheers,

André

*) For instance, there could be properties that give even finer control 
over the radius, so you can make an inverted rounded corner, or have 
different radii for the x and y axis, or...




More information about the Development mailing list