[Interest] Autoscrolling bug in QML ListView with overlaid header?

Elvis Stansvik elvstone at gmail.com
Fri Dec 30 13:59:33 CET 2016


Hi all,

Here's a minimal test case (run with qmlscene):

import QtQuick 2.4
import QtQuick.Window 2.2

ListView {
    width: 300
    height: 300
    model: 10
    focus: true
    header: Rectangle {
        z: 2
        width: parent.width
        height: 100
        Text {
            text: "Header"
        }
    }
    headerPositioning: ListView.OverlayHeader
    delegate: Rectangle {
        width: parent.width
        height: 50
        color: activeFocus ? "red" : "blue"
        Text {
            anchors.centerIn: parent
            text: "Item " + modelData
        }
    }
}

Notice how, if you first go down to the last item with the Down key,
then go upwards, the view will not automatically scroll to show the
current item when it is underneath the overlaid header. It seems to
not take the overlaid header into account when calculating the area in
which items are visible somehow.

Has anyone bumped into this and know of a workaround. I guess it might
be fixed in recent versions, but my app must work with Qt 5.5.1 as
packaged for Ubuntu Xenial.

Many thanks in advance,
Elvis



More information about the Interest mailing list