1

I am transitioning a GUI from Qt 5.15 QML to Qt 6.0.2 QML but an error has occurred in ScrollBar behavior. I have discovered the issue with MacOS 10.15.7 and I don't know where it exists elsewhere. I create a minimal custom ScrollBar and attach it to a ListView. The scroll indicator works fine in 5.15 but in 6.x the scroll indicator fills the entire scroll regardless of whether or not it should. Has behavior changed or is this a bug?

I create CustomScrollbar.qml as follows:

import QtQuick 2.15
import QtQuick.Controls 2.15
ScrollBar {
    contentItem: Rectangle {
        implicitWidth: 15
        color: "red"
    }
}

and then use it in a basic ListView:

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
Window {
    width: 300; height: 100; visible: true

    ListView {
        id:listView
        anchors.fill:parent
        ScrollBar.vertical: CustomScrollbar {}

        model: ListModel {
            ListElement {name: "Bill"} ListElement {name: "Bob"} ListElement {name: "Andy"} ListElement {name: "Jim"}
            ListElement {name: "Ralph"} ListElement {name: "Ed"} ListElement {name: "Bill"} ListElement {name: "Bill"}
        }
       delegate: Text {
           text: name
       }
    }
}

Qt 5.15 produces a properly positioned indicator (left) but Qt 6.0.2 does not scale properly and does not scroll:

BadScrollsBadScrollsWhatchaGonnaDo

Steve
  • 3,711
  • 22
  • 45
  • Setting the matter aside, I'd suggest using properties [`horizontal`](https://doc.qt.io/qt-5/qml-qtquick-controls2-scrollbar.html#horizontal-prop) and `vertical` in you custom scroll bar component to bind its `implicitWidth` and height conditionally. – ratijas Mar 17 '21 at 08:00

1 Answers1

0

At the time of this writing the issue appears to be accepted as a verified bug in Qt 6 (see here) that has been assigned a P2 - Important level. As of several months before this post, an article by Phoronix notes that there are over 1000 P1 - Critical bugs languishing in Qt so it is unclear if the lower level P2 will see attention soon.

It might be possible to use an external, non-attached scrollbar to workaround this issue but care would need to be taken to not corrupt flickable behavior in the process.

Steve
  • 3,711
  • 22
  • 45