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

When using ListView.ApplyRange, header/footer is not auto-displayed when moving to first/last items via key events

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.0.0, 5.4.0 Beta
    • Quick: Other
    • None

    Description

      The fix for QTBUG-17853 ensures the header/footer is displayed if the view reaches the first/last items via key navigation. However, the fix doesn't work for cases where ListView.ApplyRange is used, as in the following example:

      import QtQuick 2.0
      
      Rectangle {
          id: root
          property int current: 0
          width: 600; height: 300
      
          ListView {
              width: 200; height: parent.height
              model: ListModel {
                  Component.onCompleted: {
                      for (var i=0; i<9; i++) {
                          append({'name': 'item ' + i, 'type': 'small', 'age': i })
                      }
                  }
              }
              delegate: petDelegate
      
              header: Rectangle {
                  height: 45; width: 200; color: "red"
                  Text { text: parent.x + ", " + parent.y }
              }
              footer: Rectangle {
                  height: 45; width: 200; color: "orange"
                  Text { text: parent.x + ", " + parent.y }
              }
              highlight: Rectangle { color: "yellow" }
              preferredHighlightBegin: 80; preferredHighlightEnd: 220
              highlightRangeMode: ListView.ApplyRange
              focus: true
          }
      
          // The delegate for each list
          Component {
              id: petDelegate
              Column {
                  width: 200
                  Text { text: 'Name: ' + name + " " + parent.y }
                  Text { text: 'Type: ' + type }
                  Text { text: 'Age: ' + age }
              }
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              bealam Bea Lam (closed Nokia identity) (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes