我想用自定义代表的分隔符显示 AppListView。分隔符应该有 2 个属性 - 颜色定义为字符串,文本也定义为字符串 - 两者都来自我的模型作为角色,它们总是成对出现,例如
- 如果颜色是
#b3b3b3
文本总是AA
, - 如果颜色是
#eeeeee
文本总是BB
.
我找不到将两个参数传递给我的部分的任何选项,因此我可以使颜色和文本都显示在我的分隔符上。
对于那些喜欢代码的人:
AppListView {
id: list
section {
property: "separatorTextRole" /* here I set my first role to be separator property */
criteria: ViewSection.FullString
delegate: CustomSeparatorDelegate {
itemColor: /* how can I pass also my separatorColorRole here? */
itemText: section /* here I access my separatorTextRole */
}
}
delegate: CustomListDelegate {
text: nameRole
row: rowRole
value: valueRole
}
}