slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 566 forks source link

`visible` don't work as the root of a repeater #1071

Closed ogoffart closed 1 year ago

ogoffart commented 2 years ago
export Demo := Window {
  width:  300px; height: 300px;
  if true :  Rectangle {
    background: blue;
    visible: false;
  }
}

In that example, the Rectangle is still visible despite the visible: false

The idea is that visible is implemented with an empty clip. However, for a repeater, we call object_tree::inject_element_as_repeated_element which itself call adjust_geometry_for_injected_parent to set the width/height but it shouldn't do that for the visibility element (it should do it for the drop shadow tough)

ogoffart commented 1 year ago

Fixed by #1852 Duplicate of https://github.com/slint-ui/slint/issues/1846