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. ListView automatically update model when scrolling

ListView automatically update model when scrolling

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 532 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.
  • D Offline
    D Offline
    DavidM29
    wrote on last edited by
    #1

    Hello,

    I do have a ListView with multiple component in it. I'm facing an issue.
    The problem is that when I scroll some element out of the visible area the component is updated. Is that normal ? Is there anyway to avoid this behaviour.

    For example I do have a switch. If I change it state and scroll down until it is not visible anymore it states goes back to it previous state by itself.

    J.HilkJ 1 Reply Last reply
    0
    • D DavidM29

      Hello,

      I do have a ListView with multiple component in it. I'm facing an issue.
      The problem is that when I scroll some element out of the visible area the component is updated. Is that normal ? Is there anyway to avoid this behaviour.

      For example I do have a switch. If I change it state and scroll down until it is not visible anymore it states goes back to it previous state by itself.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @DavidM29
      I'm afraid that is intended behavior .

      The components get created when they come into view and get destroyed when they disappear.

      And on creation, the default values are loaded.

      If you want the preserve the state of your components, make changing them actually do something.
      E.g. changing the data in the model, changing the underlying c++ backend or store them in inside values in your QML file.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      D 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @DavidM29
        I'm afraid that is intended behavior .

        The components get created when they come into view and get destroyed when they disappear.

        And on creation, the default values are loaded.

        If you want the preserve the state of your components, make changing them actually do something.
        E.g. changing the data in the model, changing the underlying c++ backend or store them in inside values in your QML file.

        D Offline
        D Offline
        DavidM29
        wrote on last edited by
        #3

        @J.Hilk
        Ok thank you. I was afraid that is was not the inteded behaviour. So I'll find a workaround solution. I think I'll store the value in QML variables.

        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