- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
P2: Important
 - 
    5.15.7, 6.2.2
 - 
    None
 
- 
        
 - 
        3818ec46b152dce97ebe88c9b1cecde8573e0a13
 
A ListView is created with a model that is initialized with a number of elements.
When the model is cleared (i.e. all elements are removed from the model), the ListView.count drops to 0 as expected, but one delegate is still visible in the ListView.
This seems to happen, when the ListView has also a header item set, only.
Attached, you'll find a sample qml file, which demonstrates the likely bug, and some screenshots. The "Screenshot-zero-elements.jpg" shows that the ListView.count is zero (at the bottom of the window), but there is still a row visible in the ListView.
A workaround for this issue seems to be to explicitly set currentIndex to -1 as initial value.
The issue did not appear prior to Qt 5.15.7.
- duplicates
 - 
                    
QTBUG-97423 heap-use-after-free in SwipeView::test_orientation
-         
 - Closed
 
 -         
 - 
                    
QTBUG-99131 ListView places old `currentItem` under new `currentItem` during a model append
-         
 - Closed
 
 -