Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Repeater should not display all model-items

[Solved] Repeater should not display all model-items

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ephe
    wrote on last edited by
    #1

    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++.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ephe
      wrote on last edited by
      #2

      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
      @
      if(bFirst)
      {
      listView.positionViewAtIndex(0, ListView.Beginning)
      }
      else
      {
      listView.positionViewAtIndex(5, ListView.Beginning)
      }
      @
      Like this I could achieve what I wanted with only one model.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved