Replies: 4 comments 5 replies
-
I do not see what you are trying to do here... Why do you set the |
Beta Was this translation helpful? Give feedback.
-
More information:
Does being inside a ListView makes it be 100% of the listview (parent) width? And if it were directly under a gridLayout it would be 100% of the inner contents (or something else)? |
Beta Was this translation helpful? Give feedback.
-
Would this be a consequence of #407? Any workaround to force the Text/Rectangle width on "loop build time"? e.g. some way to get the string rendered width? or to force the layout calculation after populating the list? |
Beta Was this translation helpful? Give feedback.
-
The problem I see (now, sorry for not seeing it earlier) is that the Rectangle may have any width, that is independent of the Text inside it. And that width is used by the ListView to calculate its size. You can either set the Rectangle's width based on the Text width or you can use any Layout to do that for you. Try this: ListView {
for data in my_content : Rectangle {
height: 30px;
width: t.preferred-width; // That's the "natural" width of the Text element we named `t`
t := Text {
text: data.name;
}
} or this: ListView {
for data in my_content : VerticalLayout {
t := Text {
text: data.name;
}
} (in this simple case a Slintpad.com (or the live-preview) is a nice way to see sizes for elements... just open the preview and move the cursor on the element name and it should highlight all occurences of that Element with a frame showing position and size. |
Beta Was this translation helpful? Give feedback.
-
is it possible to have something with
min-width: content
so that it fill the entire space, but shows a scroll bar if the space is not large enough?e.g.
Beta Was this translation helpful? Give feedback.
All reactions