[Solved] ListView Custom snapMode



  • Hi everyone. I have the following ListView
    @import Qt 4.7

    Rectangle {
    width: 500
    height:500

     VisualItemModel {
         id: itemModel
         Rectangle { height: 500; width: 500; color: "red" }
         Rectangle { height: 500; width: 500; color: "green" }
         Rectangle { height: 500; width: 500; color: "blue" }
     }
    
     ListView {
         anchors.fill: parent
         model: itemModel
         orientation: "Horizontal"
         highlightRangeMode: ListView.StrictlyEnforceRange
    
         boundsBehavior: Flickable.DragOverBounds
    
         snapMode: ListView.SnapOneItem
     }
    

    }
    @

    So when you change from red to green item the listview snap to the green mode(snapMode: ListView.SnapOneItem). What I want is a way to define a custom snapMode, with other words I want to snap first time on on half of the red item width size and then snap to the green item.

    It is possible?



  • never mind. I found the solution. for those who are interested:

    "preferredHighlightBegin":http://doc.qt.nokia.com/4.7/qml-listview.html#preferredHighlightBegin-prop


Log in to reply
 

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