Hi,

It seems that delegates are already created when ListView is still re-sizing 
and that messes up the populate transition leaving some delegates to opacity 
zero. It is a bug can you report it @ https://bugreports.qt-project.org/? 
please.


Assigning  model after ListView has re-sized works with anchors and proofs that 
it is a bug.


ApplicationWindow {
    id: main

    visible: true
    height: 300
    width: 300


    ListModel {
        id: modelData
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
        ListElement {
            name: "Sam Wise"
            number: "555 0473"
        }
    }

    Rectangle {
        anchors.fill: parent
        ListView {
            id: lw
            anchors.fill: parent
            onHeightChanged: lw.model = modelData
            delegate: Rectangle {
                height: 40
                width: 300
                opacity: 0.0
                color: "lightgray"
                Text {
                    anchors.centerIn: parent
                    text: name
                }
                Component.onCompleted: console.log(name)
            }

            populate: Transition {
                NumberAnimation { property: "opacity"; to: 1.0 ; duration: 1000 
}
            }
        }
    }
}


Samuel Nevala


________________________________
From: interest-bounces+samuel.nevala=theqtcompany....@qt-project.org 
<interest-bounces+samuel.nevala=theqtcompany....@qt-project.org> on behalf of 
ashish dabhade <ashishd...@gmail.com>
Sent: Monday, November 10, 2014 12:45 PM
To: interest@qt-project.org
Subject: [Interest] QML ListView anchoring fails

Hi All,

Why is it that anchoring (fill) ListView to parent fails in following example ?

ApplicationWindow {
    id: main
    visible: true
    height: 300
    width: 300

    Rectangle {
        anchors.fill: parent
        ListView {
            anchors.fill: parent
            model: ListModel {
                id: modelData
                ListElement {
                    name: "Bill Smith"
                    number: "555 3264"
                }
                ListElement {
                    name: "John Brown"
                    number: "555 8426"
                }
                ListElement {
                    name: "Sam Wise"
                    number: "555 0473"
                }
            }
            delegate: Rectangle {
                height: 40
                width: 300
                opacity: 0.0
                color: "lightgray"
                Text {
                    anchors.centerIn: parent
                    text: name
                }
            }
            populate: Transition {
                NumberAnimation { property: "opacity"; to: 1.0; duration: 1000 }
            }
        }
    }
}

If ListView or Rectangle is given width or height it works as expected. Is it a 
bug or am i missing something ?
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to