> On 22 Dec 2023, at 13:59, Lars Knoll via Development 
> <development@qt-project.org> wrote:
> 
>> 
>> On 22 Dec 2023, at 13:54, Tor Arne Vestbø via Development 
>> <development@qt-project.org> wrote:
>> 
>>> On 22 Dec 2023, at 13:20, Giuseppe D'Angelo via Development 
>>> <development@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.
> 
> I’m not 100% sure about this. “Radius" without any pre/postfix is IMO 
> somewhat confusing on a rectangle. HTML uses “borderRadius”, which I actually 
> like quite a bit. And as it’s a new property, it would also not cause 
> conflicts with the old name.
> 
> Cheers,
> Lars



CSS has https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius

plus the per-corner values, e.g. 
https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius

That is not specific to a rectangle though, and “border” is a well-defined CSS 
concept, so I’m not quite convinced that a rectangle’s “borderTopLeftRadius” 
makes sense. What happens to the fill?


We have “Rectangle.radius" today already, and we cannot/should not overload 
properties (radius as either holding a real, or a gadget type).

QPainter::drawRoundedRect [1] has parameters xRadius, yRadius, so evidently 
there are use cases for customizing the rounding of corners beyond a single 
value.

[1] https://doc.qt.io/qt-6/qpainter.html#drawRoundedRect

Making the whole thing into a grouped property would be nice indeed, but if we 
want to make it extensible, then “cornerProperties” is perhaps an option. That 
allows us to have all sorts of values for each corner, and the question becomes 
at some point whether we are over-engineering the simple concept of a rectangle.

Volker

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to