Steve
Steve

Reputation: 4097

Errors with Customized ScrollBar Sizing Porting Qt 5.15 QML to Qt 6.0.2 QML

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

Upvotes: 1

Views: 500

Answers (1)

Steve
Steve

Reputation: 4097

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.

Upvotes: 0

Related Questions