Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] ListView Custom snapMode

[Solved] ListView Custom snapMode

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 4.0k Views
  • 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 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    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
    0
    • 2 Offline
      2 Offline
      2beers
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved