Closed ogoffart closed 7 months ago
The question is wether the behavior of a 1px transparent border is actually not something:
Rectangle {
border-width: 100px;
border-color: transparent;
color: blue;
width: 500px; height: 500px;
}
Is the rectangle size 500 or 300 px? if the transparent border adds some "margins", we cannot default to 1px. (Current behavior, the 300px, CSS behavior: 500px, QML: somehow like CSS, but broken) => We should do the same as CSS, so we could default to 1px
Implementation wise, we should make sure that adding a default property to the border don't make everything an BorderRectangle
The background should cover the full item width/height (including the border) the border size should default to 1px.
This is a breaking change so maybe only do that with the new syntax. (and the updater can add a border-width: 0px if a border-color is set
(or we just don't care and change the behevior before 1.0 )
The issue about whether the rectangle's size is 300 or 500, how the border affects clipping, is now in https://github.com/slint-ui/slint/issues/1988 .
I've had a few issue with this.
Setting the 1px
in the builtins.slint makes a binding that causes resolve_native_classes
to always select the BorderRectangle. Even if i filter that, we get then further panic later as we try to set this binding. So more work is required to get it work without always picking a BorderRectangle
When clip:true
we currently clip the part within the border. We've done the background part of #1988 , but haven't decided yet on the clipping part. But changing the default of the border to 1px would have desastrous consequence on the clipping then, so we should only do that if we really say that the clip clips outside of the border.
But changing the default of the border to 1px would have desastrous consequence on the clipping then, so we should only do that if we really say that the clip clips outside of the border.
In https://github.com/slint-ui/slint/issues/1988#issuecomment-1386646549, what did you mean with "But in a sense, i think it makes more sense to take the border into account." ? Do you mean that clip: true
should be like CSS's border-box
or like content-box
?
Blocked on #1988
We need to have a way so that a 1px border wouldn't mean that the clip is shifted by 1px
Probably a bit too magical.
Since the border-color defaults to transparent, setting only one of these property should be enough to make a visible border