Important: Please read the Qt Code of Conduct -

[Solved] Repeater should not display all model-items

  • I have got one model and two repeaters.
    I would like to show the first half of the model items in the first repeater and the second half in the second repeater. The visibility of the repeaters can be toggled (if 1 is visible, 2 is invisible and the other way around)

    Is it somehow possible to split a model in QML so that it can be used in two repeaters?

    I was also thinking about creating two models, but I would like to have only one model.
    The model is created in C++.

  • I have solved my problem.
    Instead of a Repeater, I'm using a ListView now which has the width of 5 elements. When I press the button to toggle the visible buttons, I set
    listView.positionViewAtIndex(0, ListView.Beginning)
    listView.positionViewAtIndex(5, ListView.Beginning)
    Like this I could achieve what I wanted with only one model.

Log in to reply