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.94k stars 568 forks source link

Conditional elements break layout #3317

Closed metalinspired closed 8 months ago

metalinspired commented 1 year ago

If this is intended behaviour it should be documented. The button does not render properly in following snippet.

import { Button, VerticalBox , HorizontalBox} from "std-widgets.slint";
export component Demo {
    HorizontalBox {
        Rectangle {
            if (true) : VerticalLayout {
                Button {
                    height: 50px;
                    width: 50px;
                    text: "OK!";
                } 
            }
        }
    }
}

If you remove if (true) : it will render fine.

Kubuntu 23.04 Slint 1.1

ogoffart commented 1 year ago

Thanks for reporting. This is already known https://github.com/slint-ui/slint/issues/407#issuecomment-897681718 but sadly not trivial to fix

ogoffart commented 8 months ago

Duplicate of #407