Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67051

StrictlyEnforceRange + sections leads to strange snapping

    XMLWordPrintable

Details

    • 50924bd8557db9a398f3c1ccdd6996d968658b23

    Description

      The example below demonstrates.

      Control: Slowly drag between 1 and 2 and release at various points – when the drag is released, we snap to the closest item.

      Issue 1: Slowly drag between 0 and 1 and release at various points – it is very difficult to get it to snap to 0.

      Issue 2: Slowly drag between 2 and 3 and release at various points – it is heavily weighted towards 3 (it is hard to go from 3 to 2).

       

      import QtQuick 2.0
      
      Item {
          width: 400
          height: 400
      
          ListView {
              anchors.fill: parent
              preferredHighlightBegin: 100
              preferredHighlightEnd: 100
              highlightRangeMode: ListView.StrictlyEnforceRange
              model: ListModel {
                  ListElement { section: "1" }
                  ListElement { section: "1" }
                  ListElement { section: "1" }
                  ListElement { section: "2" }
                  ListElement { section: "2" }
                  ListElement { section: "2" }
                  ListElement { section: "3" }
                  ListElement { section: "3" }
                  ListElement { section: "3" }
                  ListElement { section: "4" }
                  ListElement { section: "4" }
                  ListElement { section: "4" }
                  ListElement { section: "5" }
                  ListElement { section: "5" }
                  ListElement { section: "5" }
                  ListElement { section: "6" }
                  ListElement { section: "6" }
                  ListElement { section: "6" }
              }
      
              delegate: Rectangle {
                  width: parent.width
                  height: 50
                  color: index % 2 ? "lightsteelblue" : "steelblue"
                  Text {
                      anchors.centerIn: parent
                      color: "white"
                      text: model.index
                  }
              }
      
              section.property: "section"
              section.delegate: Rectangle {
                  width: parent.width
                  height: 50
                  color: "green"
                  Text {
                      anchors.centerIn: parent
                      color: "white"
                      text: "section"
                  }
              }
      
              highlight: Rectangle {
                  y: 100
                  z: 2
                  width: parent.width
                  height: 50
                  color: "#80FF0000"
              }
          }
      }
      
      

      Attachments

        For Gerrit Dashboard: QTBUG-67051
        # Subject Branch Project Status CR V

        Activity

          People

            mbrasser Michael Brasser
            mbrasser Michael Brasser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes