Scroll two or more ListViews Using Single ScrollBar



  • Hello, I need to scroll two or more list view at once using a single scrollBar. Initially, i used Column inside a Flickable but scroll was not happening as expected. Later, I used ListView and even that was not scrolling correctly.

    So,how to scroll a listview/layout content item with a scroll bar? Should I use ScrollView or Flickable or something else?

    Example of My UI



  • With Qt Quick Controls 2:

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    
    ApplicationWindow {
        id: window
        width: 640
        height: 480
        visible: true
    
        Row {
            anchors.fill: parent
            anchors.margins: vbar.width
    
            ListView {
                width: parent.width / 2
                height: parent.height
                model: 100
                delegate: ItemDelegate {
                    width: parent.width
                    text: "A" + modelData
                }
                ScrollBar.vertical: vbar
            }
    
            ListView {
                width: parent.width / 2
                height: parent.height
                model: 100
                delegate: ItemDelegate {
                    width: parent.width
                    text: "B" + modelData
                }
                ScrollBar.vertical: vbar
            }
        }
    
        ScrollBar {
            id: vbar
            height: parent.height
            anchors.right: parent.right
            policy: ScrollBar.AlwaysOn
        }
    }
    


  • This post is deleted!


  • @jpnurmi Thanks !!! its working



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