【发布时间】:2021-04-27 16:53:30
【问题描述】:
您好,我有一个 DelegateChooser 对应一个 TableView 和 10-20 个不同的 DelegateChoices。如何将相同的背景应用于所有选项?我想避免必须为所有选项添加相同的背景,因为这是大量的重复代码和令人头疼的维护问题:
DelegateChoice: {
Item {
Rectangle { id: background; anchors.fill: parent; color: "blue" }
Choice1 {}
}
...
Item {
Rectangle { id: background; anchors.fill: parent; color: "blue" }
Choice20 {}
}
}
【问题讨论】:
标签: qt qml qtquick2 qtquickcontrols2 qtdeclarative