MyComponent
我不能使用
ColumnLayout {
MyComponent { text: "a" }
MyComponent { text: "b" }
MyComponent { text: "c" }
MyComponent { text: "d" }
MyComponent { text: "e" }
}
,因为每个元素都应具有不同的文本。现在,假设我想水平拉伸这些元素。在一个Repeater
中,我想你必须这样做:
ColumnLayout
但这意味着我必须为每个单个
ColumnLayout {
MyComponent {
text: "some text"
Layout.fillWidth: true
}
}
手动执行此操作,因为columnlayout设置
MyComponent
不起作用。那么如何为子元素设置默认布局之类的东西呢?我怎么只说Layout.fillWidth: true
中的每个元素都应水平拉伸?
(顺便说一下不是屈曲物品,当我希望水平拉伸每个项目时,我可以说ColumnLayout
高于孩子的水平,因此它控制了如何定位孩子,而不是相反的方式。
this语句我不能使用中继器,因为每个元素都应具有不同的文本 不正确,因为
不同的文本可以放在中继器的模型中,即。
align-items: center
您可以在网上浏览它!