Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML ListView nesting GridView, the ScrollBar behavior is not natural



  • I have a requirement about show the Photo gallery group by datetime.
    I use a QML ListView nesting GridView,It looks like:
    1.PNG
    It looks well unit I add a ScrollBar in ListView:

    Scrollbar.vertical : Scrollbar {
        hoverEnabled : true
        active : hovered ||pressed
        orientation : Qt . Vertical
        anchors.top : parent . top
        anchors.right : parent . right
        anchors.bottom : parent , bottom
        contentItem : Rectangle {
            timplicitwidth : 6
            implicitheight : 100
            radius : width / 2
            color : "#0f1c3e"
        }
    }
    

    When I scroll in ListView The scorllbar changed it's size and position on changed the currentItem in ListView.
    1.PNG
    2.PNG

    I don't know why about it,but I found the contentHeight will change to the currentItem height after scroll the listView.
    I want get the actual behavior scroll bar,What need I do?


Log in to reply