Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

ListView item disappears (not repainted) after scrolling outside visible area

$
0
0
The problem seems to arise from using a Rectangle to encapsulate the Delegates. I want the extra layout provided inside a Rectangle component in order to use different items inside the Delegate to display different fields. This QML code seems sufficient to reproduce the problem:        ListModel {             id: longModel               Component.onCompleted: {                 for ( var i=1; i<=100; i++ )                     append({"testName": i})             }         }             ListView {             anchors.fill: parent                 id: listView                 model: longModel               delegate:                 Rectangle {                 height: textComponent.height*2                 width: parent.width                   Text {                     id: textComponent                     text: testName                 }             }         } A workaround is to place the Text component inside a RowLayout instead of a Rectangle. Another workaround is to place the Rectangle inside an Item (i.e. use delegate: Item{ Rectangle{ Text{} }}) But nevertheless, shouldn’t it be possible to successfully use a Delegate with Text inside Rectangle, as done in the sample code?

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images