Important: Please read the Qt Code of Conduct -

Prevent Listview from updating items

  • 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?

  • Moderators

    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.

Log in to reply