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

Elvis Stansvik elvstone at gmail.com
Fri Dec 30 14:16:21 CET 2016


2016-12-30 13:59 GMT+01:00 Elvis Stansvik <elvstone at gmail.com>:
> 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.

To follow up: Like I suspected, it seems it's fixed in 5.6:

    https://codereview.qt-project.org/#/c/144496/

But does anyone know if it's possible to work around in 5.5?

Elvis

>
> Many thanks in advance,
> Elvis



More information about the Interest mailing list