-
How do i make a button that clones itself or at the very least can make a Rectangle. I'm new to slint and would very much appreciate any help i recieve |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Apr 2, 2025
Replies: 1 comment
-
You probably just want to use a |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ddfasf68
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You probably just want to use a
for
to construct the button.For example: https://slintpad.com/?snippet=import+%7B+Button%2C+VerticalBox+%7D+from+%22std-widgets.slint%22%3B%0A%0Aexport+component+Demo+%7B%0A%0A++++property+%3Cint%3E+button-count%3A+1%3B%0A%0A++++VerticalBox+%7B%0A++++++++alignment%3A+start%3B%0A++++++++for+_+in+button-count%3A+Button+%7B+%0A++++++++++++text%3A+%22Clone+Me%21%22%3B%0A++++++++++++clicked+%3D%3E+%7B+button-count+%2B%3D+1%3B+%7D%0A++++++++%7D%0A%0A++++++++Rectangle+%7B+height%3A+100px%3B+%7D%0A++++%7D%0A%7D%0A