【发布时间】:2014-09-29 12:56:42
【问题描述】:
我创建了一个 ListView,它显示了用户定义的几页内容(纯文本)。显示的页面是一个委托。一次只能看到一页。我决定用它来捕捉一个项目,就像 iOS 启动器的工作方式一样。用户只需在页面之间滑动即可。 (这是在触摸屏上使用的)
我需要有当前显示页面的索引才能进行某些操作。 ListView 的 currentIndex 始终保持 == 0。我怎样才能得到它?
对于喜欢代码的人:
ListView
{
onCurrentIndexChanged: console.log(currentIndex) // this gets called only once - at startup
delegate: Column
{
// The page displayed, only one page at a time
}
}
谢谢
【问题讨论】: