mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-15 00:55:24 +00:00

In 80de96488a
(#3397) we introduced a new
error if we detect a binding loop from the Window geomerty to its layout.
But it looks like this causes a lot of error in existing project, so
make it a warning instead.
It will continue to be an error in the live preview as this will cause a
panic otherwise.
This commit also change the text of the error to include the actual
binding loop. I hope this makes it easier for users to see the loop and
help to fix it.
47 lines
2.6 KiB
Text
47 lines
2.6 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
|
|
WithStates := Rectangle {
|
|
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
|
|
property <brush> extra_background;
|
|
property <bool> condition;
|
|
background: yellow; //FIXME: ideally we'd keep the span within the state
|
|
// ^error{The binding for the property 'background' is part of a binding loop (extra-background -> background)}
|
|
states [
|
|
xxx when condition : {
|
|
background: extra_background;
|
|
}
|
|
]
|
|
}
|
|
|
|
export Test := Rectangle {
|
|
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
|
|
|
|
property <int> a: 45 + root.b;
|
|
// ^error{The binding for the property 'a' is part of a binding loop (root_window.d -> root_window.c -> root_window.b -> root_window.a)}
|
|
property <float> b: root.c;
|
|
// ^error{The binding for the property 'b' is part of a binding loop (root_window.d -> root_window.c -> root_window.b -> root_window.a)}
|
|
property <int> c <=> d;
|
|
// ^error{The binding for the property 'c' is part of a binding loop (root_window.d -> root_window.c -> root_window.b -> root_window.a)}
|
|
property <int> d: root.a + root.e;
|
|
// ^error{The binding for the property 'd' is part of a binding loop (root_window.d -> root_window.c -> root_window.b -> root_window.a)}
|
|
property <int> e: root.b;
|
|
// ^error{The binding for the property 'e' is part of a binding loop (root_window.e -> root_window.d -> root_window.c -> root_window.b)}
|
|
property <int> w: root.a + root.b; // This id not part of a loop
|
|
|
|
property<bool> cond: xx.x == 0;
|
|
// ^error{The binding for the property 'cond' is part of a binding loop (xx.y -> xx.x -> root_window.cond)}
|
|
|
|
xx := Rectangle {
|
|
x: y;
|
|
// ^error{The binding for the property 'x' is part of a binding loop (xx.y -> xx.x -> root_window.cond)}
|
|
y: root.cond ? 42px : 55px;
|
|
// ^error{The binding for the property 'y' is part of a binding loop (xx.y -> xx.x -> root_window.cond)}
|
|
}
|
|
|
|
WithStates {
|
|
extra_background: background;
|
|
// ^error{The binding for the property 'extra-background' is part of a binding loop (extra-background -> background)}
|
|
}
|
|
}
|