[Development] QML Rectangle corner radius API for Qt 6.7

André Somers andre at familiesomers.nl
Fri Dec 22 13:57:29 CET 2023


On 22-12-2023 13:20, Giuseppe D'Angelo via Development wrote:
> Il 22/12/23 11:15, André Somers ha scritto:
>> 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.
>
> While at it, it should be aptly named `cornersRadii` or similar.
`cornerRadii` in that case.
>
> `radius` has always violated Qt API guidelines. A rectangle doesn't 
> have a radius. We shouldn't be doing the same mistake again.
>
>
>> 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.
>
> I'm not sure how this would look like in code, though?

In QML code? Something like this, I imagine:

```qml
Rectangle {
   id: textBalloon
   radius: 5
   color: palette.theirMessagePrimary
   corners.topLeft {
     radius: 10
     color: palette.theirMessageSecondary
   }
   // ... message content, whatever
}

```

André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231222/836df38d/attachment.htm>


More information about the Development mailing list