Closed HookedBehemoth closed 7 months ago
Thanks for the bug report!
Indeed, the interpreter used by the preview and slintpad hardcode the "index" property in https://github.com/slint-ui/slint/blob/6563bf0981ca882e72ad7e217a53e7adf07fc805/internal/interpreter/dynamic_item_tree.rs#L115
This can even lead to more severe bugs. For example, this panics because at runtime, index
is no longer a string as expected.
export component Demo {
HorizontalLayout {
for i in 12: Text {
property <string> index: "hello";
text: index;
}
}
}
Awesome! Thanks for the quick fix.
Hey, I tried to create a simple clock in a slint component and a custom property with the name "index" got overwritten in my for loop. index is described as optional in the slint book and should require brackets. Defining it myself makes it so it's always overwritten and my assignment is ignored. Renaming the property to anything else makes my code work again. You can test the code below in slintpad https://slint.dev/releases/1.5.1/editor/