Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is possible to scroll multiple Listviews together in qml??

this was my attempt:

        Flickable {
            id: scoreflick
            anchors.top: namesrow.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.leftMargin: units.gu(2)
            anchors.topMargin: units.gu(2)

            Row {
                spacing: namesrow.spacing

                ListView {
                            id: p1list
                            width: units.gu(9)
                            height: units.gu(20)
                            model: 30

                            delegate: TextField {
                                width: ListView.view.width
                                height: units.gu(3)
                                text: "Score"
                            }
                        }

                ListView {
                            id: p2list
                            width: units.gu(9)
                            height: units.gu(20)
                            model: 30

                            delegate: TextField {
                                width: ListView.view.width
                                height: units.gu(3)
                                text: "Score"
                            }
                        }

                ListView {
                            id: p3list
                            width: units.gu(9)
                            height: units.gu(20)
                            model: 30

                            delegate: TextField {
                                width: ListView.view.width
                                height: units.gu(3)
                                text: "Score"
                            }
                        }

                ListView {
                            id: p4list
                            width: units.gu(9)
                            height: units.gu(20)
                            model: 30

                            delegate: TextField {
                                width: ListView.view.width
                                height: units.gu(3)
                                text: "Score"
                            }
                        }

            }

        }

        Scrollbar {
            flickableItem: scoreflick
            align: Qt.AlignTrailing
        }

but each Listview scroll by itself and the Scrollbar does not work at all... any help?

share|improve this question

1 Answer 1

The following helped me. You will need somehow:

    onContentXChanged: {
        if(activeFocus){
            p2list.contentX = p1list.contentX  
iterate all list
for (var i=0; i<listOfListView.children.length; i++){
    if(listOfListView.children[i].activeFocus) {

    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.