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 :(
A ListView displays data from models created from built-in QML types like ListModel. A ListView has a model, which defines the data to be displayed, and a delegate, which defines how the data should be displayed. Items in a ListView are laid out horizontally or vertically.
delegate : Component. The delegate provides a template defining each item instantiated by a view. The index is exposed as an accessible index property. Properties of the model are also available depending upon the type of Data Model.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With