Qt World Summit: Submit your Presentation

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:



Log in to reply