Contact list example doesn't work as expected



  • Hi there!
    I just downloaded the last SDK 1.1.3 (Qt 4.7.4) and i tried to run a few QML examples. Everything was fine until i tried next example:

    @Rectangle{
    width: 800; height: 200
    color: "lightblue"

    Rectangle {
        width: 300; height: 200; color: "white"
    
        ListModel {
            id: nameModel
            ListElement { name: "Alice"; file: "star.svg" }
            ListElement { name: "Bob"; file: "night.svg" }
            ListElement { name: "Jane"; file: "star.svg" }
            ListElement { name: "Harry"; file: "star.svg" }
            ListElement { name: "Wendy"; file: "night.svg" }
        }
    
        Component {
            id: nameDelegate
            Item {
                id: delegateItem
                width: parent.width
                height: 28
    
                states: State {
                    name: "current"
                    when: ListView.isCurrentItem
                    PropertyChanges {
                        target: delegateItem
                        height: 44
                    }
                }
                transitions: Transition {
                    NumberAnimation {
                        properties: "height"
                        duration: 300
                        easing.type: "InOutQuint"
                    }
                }
    
                Text {
                    text: name
                    font.pixelSize: parent.height - 4
                    anchors.left: parent.left
                    anchors.verticalCenter: parent.verticalCenter
                }
                Image {
                    source: file
                    fillMode: Image.PreserveAspectFit
                    smooth: true
                    sourceSize: Qt.size(64,64)
    
                    width: height; height: parent.height - 4
                    anchors.right: parent.right
                    anchors.verticalCenter: parent.verticalCenter
                }
            }
        }
    
        ListView {
            id: listView
            anchors.fill: parent
    
            model: nameModel
            delegate: nameDelegate
            focus: true
            clip: true
    
            header: Rectangle {
                width: parent.width; height: 10;
                color: "#8080ff"
            }
            footer: Rectangle {
                width: parent.width; height: 10;
                color: "#8080ff"
            }
            highlight: Rectangle {
                width: parent.width; height: 10;
                color: "lightgray"
            }
        }
    
    }
    

    }
    @

    The state and transition doesn't work and i don't know why. I checked out that "ListView.isCurrentItem" is always false on "when" property. When i run the same example using the previous version, it worked. So, what's happening here? Any ideas?



  • Hi,

    Does it work if you change the when line to the following?

    @when: delegateItem.ListView.isCurrentItem@

    If this is a regression, it would be much appreciated if you could raise an issue at http://bugreports.qt.nokia.com .

    Regards,
    Michael



  • Yes! It worked!!
    Thanks a lot Michael, i just sent a reply about the issue at https://bugreports.qt.nokia.com/browse/QTBUG-21855

    Best Regards!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.