ListView and property spacing



  • If you move an item to the value of more than half of the "spacing", but less than the "spacing", the element will freeze.

    @import QtQuick 1.1

    Rectangle {
    width: 700
    height: 560
    ListModel {
    id: pictureListModel
    ListElement {
    color: "red"
    }
    ListElement {
    color: "blue"
    }
    ListElement {
    color: "green"
    }
    }

    ListView {
        id: pictureListView
        focus: true
        anchors.fill: parent
        orientation: ListView.Horizontal
        model: pictureListModel
        snapMode: ListView.SnapOneItem
        spacing: 50
        highlightRangeMode: ListView.StrictlyEnforceRange
        highlight: Rectangle {
            color: "yellow"
            opacity: 0.5
        }
    
        delegate: Rectangle {
            width: ListView.view.width
            height: ListView.view.height
            color: model.color
            opacity: 0.5
        }
        onContentXChanged: console.log("onContentXChanged: " + contentX)
    }
    

    }
    @

    Bug or am I doing something wrong?



  • Hi,

    This seems to work for me with a custom-built 4.7 HEAD -- I think this was a bug that has since been fixed (but I don't know that the fix has been released yet). I'd suspect the following commits are likely responsible for the fix:

    http://qt.gitorious.org/qt/qt/commit/f85819fe083ae7c6804c884de68e906d153a6d11
    http://qt.gitorious.org/qt/qt/commit/09cd2f818208a83489fae034b80e6497b7cc83af

    Regards,
    Michael


Log in to reply
 

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