是否可以使 QML ListView 循环?
我已经在 QML 中实现了一个简单的列表模型和列表委托,现在很好奇使底层列表循环是否可行。 以下是代码片段:
Common.MarketsListView {
id: markets
anchors.top: logoImage.bottom
anchors.topMargin: 5
cacheBuffer: 20000
NumberAnimation on x {
running: runtime.isActiveWindow
loops: Animation.Infinite
from: 0
to: -300
duration: 20000
}
目前,列表慢慢向左移动,但当它到达末尾时,只显示最后几个项目。因此,我要么使底层列表成为循环列表,要么硬编码跳转到第一个列表项:(
I've implemented a simple list model and list delegate in QML, and now curious if it feasible to make the underlying list cyclic.
Here is the code snippet:
Common.MarketsListView {
id: markets
anchors.top: logoImage.bottom
anchors.topMargin: 5
cacheBuffer: 20000
NumberAnimation on x {
running: runtime.isActiveWindow
loops: Animation.Infinite
from: 0
to: -300
duration: 20000
}
Currently, the list slowly moves to the left, but as it reaches the end only few last items are shown. So I shall either make the underlying list cyclic, or hard-code the jump to the first list item :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法使用 ListView 执行此操作,但您可以使用 PathView 获得所需的行为,例如 https://doc.qt.io/archives/qt-4.7/declarative-ui-components-spinner.html
You can't do this with a ListView, but you may be able to get the bahavior you want using PathView, e.g. https://doc.qt.io/archives/qt-4.7/declarative-ui-components-spinner.html