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. Prevent Listview from updating items
Forum Updated to NodeBB v4.3 + New Features

Prevent Listview from updating items

Scheduled Pinned Locked Moved QML and Qt Quick
listviewdelegate
2 Posts 2 Posters 924 Views 2 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.
  • patrikdP Offline
    patrikdP Offline
    patrikd
    wrote on last edited by
    #1

    Hi all,
    is there a way to temporaly prevent the listview from updating the delegates?
    I have two listviews, one for the landscape view and one for portrait. Within my
    application this listviews can be resized. The delegates within those listviews
    depend on how currently the listview is displayed. One listview is always visible
    the other is hidden.
    Problem is that also the hidden listview applies the resizing which causes in both
    listviews the delegates to be updated which costs a lot of cpu :(
    Is there a way to completely deactivate a listview?
    Thx,
    Patrik

    p3c0P 1 Reply Last reply
    0
    • patrikdP patrikd

      Hi all,
      is there a way to temporaly prevent the listview from updating the delegates?
      I have two listviews, one for the landscape view and one for portrait. Within my
      application this listviews can be resized. The delegates within those listviews
      depend on how currently the listview is displayed. One listview is always visible
      the other is hidden.
      Problem is that also the hidden listview applies the resizing which causes in both
      listviews the delegates to be updated which costs a lot of cpu :(
      Is there a way to completely deactivate a listview?
      Thx,
      Patrik

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by p3c0
      #2

      Hi @patrikd,
      You can keep a boolean property which will be updated as required. Use this as a condition for the model.

      property bool updateNeeded: false
      ...
      ListView {
         model: updateNeeded ? myModel : null
      }
      

      When the property updateNeeded is updated to true the binding will reevaluate and items should be populated.

      157

      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