Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16352

Clearing ListView does not update its content size properties

    XMLWordPrintable

Details

    Description

      Run attached example clear_listview_model_issue.qml file with qmlviewer. Adding and removing items from vertical ListModel causes the contentHeight to be updated appropriately, but clearing the whole model does not cause a similar update to the content size. This breaks scrollbar behavior, which thinks there is content to scroll, even though in reality there is none. Similarly, content size is not updated when removing the last item from the model.

      import QtQuick 1.0
      
      ListView {
          model: ListModel { .. }
          Component.onCompleted: model.clear() // contentHeight remains unchanged
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            jpetrell Joona Petrell
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes