How to make a grid with infinite scrollbar in Qml



  • Hello friends,

    How to make a grid with infinite scrollbar in Qml?

    This is my code:
    Scrollbar.qml
    @Rectangle {
    id: scrollbar

    property real position: handle.y / (height - handle.height)
    
    width: 30
    radius: 5
    color: "#af3636"
    border.color: "#000000"
    
    Rectangle {
        id: handle
        width: scrollbar.width
        height: 25
        color: "#8d8c8c"
        radius: 3
        border.color: "#d9d8d8"
    
        MouseArea{
            anchors.fill: parent
            drag.target: handle
            drag.axis: Drag.YAxis
            drag.minimumY: 0
            drag.maximumY: scrollbar.height - handle.height
        }
    }
    

    }
    @

    Main.qml // I'm not sure if it's correct
    @ Rectangle {
    id: hallEditorFon
    x: 0; y: 0;
    width: parent.width - 260
    height: parent.height - 100
    color: "white"
    clip: true

        anchors.rightMargin: 30
    
        Scrollbar {
    
         id: scrollbar
    
    
         anchors.right: hallEditorFon.right
         anchors.bottom: parent.bottom
         anchors.top: parent.top
    
        }
    
        Grid {
            columns: 15
    
            Repeater {
                model: parent.columns * parent.columns
                Rectangle {
                    border.color: "#cfcfcf"
                    border.width: 1
    
                    color: "#000000ff"
                    width: 80; height: 80
                }
            }
    
        }
    
    
    }@
    

    Any help would be very appriciated,
    Karen


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.