Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Blocking the ListView position when refreshing the model
Qt 6.12 LTS is out! See what's new in the release blog

Blocking the ListView position when refreshing the model

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 616 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.
  • C Offline
    C Offline
    Creatorczyk
    wrote on last edited by
    #1

    Hi,
    I have a QListView with a ScrollBar in a Qml application. The model is refreshed every 2 seconds. Whenever it is updated, the list view is reset to the top. How to make the position of view not change? The number of elements in the model is unchanged.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
      wrote on last edited by
      #2

      Since the model is refreshing you can try to remember current index & set the currentIndex every time you reset the model.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      https://www.pthinks.com

      1 Reply Last reply
      1
      • GrecKoG Online
        GrecKoG Online
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        What is the type of the model? How is it refreshed?

        You should use a proper QAbstractListModel if you have a dynamic 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
        • Unsolved