如何在ListView的项目之间设置自定义分隔符 [英] How to set custom separator between items of ListView

查看:133
本文介绍了如何在ListView的项目之间设置自定义分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法像 headerfooter 属性一样使用自定义委托作为 ListView 的每两个连续项之间的分隔符?

Is there a way to use custom delegate as a separator between every two consecutive items of ListView just like header and footer properties?

推荐答案

ListView 可以分为 sections,也就是组.该文档提供了一个很好的示例此处.

A ListView can be divided in sections, aka groups. The documentation provides a nice example here.

基本上你定义一个 Component,就像你为 HeaderFooter 所做的一样,并在 section.delegate 中设置它 子属性.在代码中:

Basically you define a Component, much like you do for Header and Footer, and set it in the section.delegate subproperty. In code:

列表视图{编号:查看[...]

ListView { id: view [...]

    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
}

这篇关于如何在ListView的项目之间设置自定义分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆