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
Forum Updated to NodeBB v4.3 + New Features

ListView automatically update model when scrolling

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 553 Views 1 Watching
  • 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 23 Apr 2019, 09:33 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 1 Reply Last reply 23 Apr 2019, 09:39
    0
    • D DavidM29
      23 Apr 2019, 09:33

      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 Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 23 Apr 2019, 09:39 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 23 Apr 2019, 09:49
      1
      • J J.Hilk
        23 Apr 2019, 09:39

        @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 23 Apr 2019, 09:49 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

        2/3

        23 Apr 2019, 09:39

        • Login

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