[Development] QML Rectangle corner radius API for Qt 6.7
André Somers
andre at familiesomers.nl
Fri Dec 22 13:59:04 CET 2023
On 22-12-2023 13:54, Tor Arne Vestbø via Development wrote:
>
>> On 22 Dec 2023, at 13:20, Giuseppe D'Angelo via Development<development at qt-project.org> 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.
>>
>> `radius` has always violated Qt API guidelines. A rectangle doesn't have a radius. We shouldn't be doing the same mistake again.
> Radius is a well established term for this in Qt, and other UI frameworks. A key principle in Qt’s API design is familiarity and consistency.
>
> We can change the `radius` property from a qreal into a group property with left/rigth/top/bottom, similar to anchors. We can detect in the setRadius setter if the incoming argument is a real, and apply that to all of the corners. That would be backwards compatible, and give a more granular API for those that need it.
And what type would the radius property return then? I guess it would
have to be the grouped type. But that would break all code that
currently creates a binding on radius expecting it to be a real.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231222/8b5167f3/attachment-0001.htm>
More information about the Development
mailing list