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.22k stars 535 forks source link

Bug - Slint Server Crashed when trying to call function from States #5246

Closed Areopagitics closed 1 month ago

Areopagitics commented 2 months ago

Thanks Devs for your work! I'm using Slint on Linux with the Visual Studio extension. It obvious that the error is root.animate: 30px; . I just need to restart the editor for the Slint extension to work again. On another note... is there a way to call a function from states?

Here is the code that creates the issue:

component Ball inherits HorizontalLayout{
    in property <bool> replaceAll: false;
    property <bool> replaceable: true;
    in property <string> name:"";
    spacing: 10px;
    height: 30px;
    animate height { duration: 300ms; easing: linear; delay: 200ms;}

    function animate() {

        root.height = 0px;

    }

    states [
        replaced when replaceable && replaceAll: {
            root.height: 50px;
            root.animate: 30px;
        }
    ]   
}
ogoffart commented 1 month ago

Thanks for the bug report!

Fixing in https://github.com/slint-ui/slint/pull/5312

ogoffart commented 1 month ago

is there a way to call a function from states?

Not at the moment, no.