有没有办法使用自定义委托(delegate)作为 ListView
的每两个连续项目之间的分隔符就像 header
和 footer
特性?
最佳答案
一个 ListView
可分为sections
,又称组。该文档提供了一个很好的示例 here .
基本上你定义一个 Component
,就像您为 Header
所做的那样和 Footer
, 并将其设置在 section.delegate
子属性。在代码中:
列表显示 {
编号:查看
[...]
section.property: "size" // <--- the splitting property name
section.criteria: ViewSection.FullString // <--- specify the way section is created (see the provided link)
section.delegate: sectionDelegate // <--- your delegate
}
关于qt - 如何在 ListView 的项目之间设置自定义分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27034972/