Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.1, 4.7.2, 5.0.0
-
None
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 }