Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [Solved] ListView Custom snapMode

    QML and Qt Quick
    1
    2
    3795
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 2
      2beers last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • 2
        2beers last edited by

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

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post