Important: Please read the Qt Code of Conduct -

Problems with a ScrollBar in a ListView

  • I've got a ScrollBar inside a ListView, which is giving me problems.

    The scrollbar responds to gestures and wheel messages, but I can't click on the thumb and drag it, or click above or below the thumb and get it to move. Actually that's not quite true: if I click on the extreme left side of the bar, it works. Or, if I move the scroll bar in from the right side of the ListView, it works as expected.

    Why would this be? Is some other control or mouse area eating my mouse events? Moving the mouse over the ScrollBar causes the thumb to highlight, so I don't think there's anything blocking mouse events. How could I go about debugging this?

         ListView {
                id: schematicList
                width: parent.width; height: parent.height 
                property var scrollBarWidth: 12
                model: myModel
                focus: true
                clip: true
                ScrollBar.vertical: ScrollBar {
                    anchors.right: schematicList.right
                    policy: ScrollBar.AlwaysOn
                    active: hovered || pressed
                    width: scrollBarWidth;
                delegate: Rectangle {
                    width: mainWindow.width -scrollBarWidth; height: mainWindow.height
                    Image {
                        id: image
                        anchors.centerIn: parent
                        width: parent.width; height: parent.height
                        fillMode: Image.PreserveAspectFit
                        source: "myImage" 
            } // end ListView

Log in to reply