Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Is it possible to have two different tableviews scroll according to eachother?

$
0
0
In QML: import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Window 2.1   Window {     visible: true     width: 360     height: 360       ListModel {         id: someNumbersModel     }       function valueChanged(value) {         firstTableView.__verticalScrollBar.value = value;         secondTableView.__verticalScrollBar.value = value;     }       TableView {         id: firstTableView           anchors.top: parent.top;         anchors.left: parent.left;         anchors.right: parent.horizontalCenter;         anchors.bottom: parent.bottom;           TableViewColumn{ role: "location"  ; title: "Location" ; width: 100 }         model: someNumbersModel           flickableItem.onContentYChanged: secondTableView.flickableItem.contentY = flickableItem.contentY         flickableItem.onContentXChanged: secondTableView.flickableItem.contentX = flickableItem.contentX     }     TableView {         id: secondTableView           anchors.top: parent.top;         anchors.left: parent.horizontalCenter;         anchors.right: parent.right;         anchors.bottom: parent.bottom;           TableViewColumn{ role: "location"  ; title: "Location" ; width: 100 }         model: someNumbersModel           flickableItem.onContentYChanged: firstTableView.flickableItem.contentY = flickableItem.contentY         flickableItem.onContentXChanged: firstTableView.flickableItem.contentX = flickableItem.contentX     }       property int a;     Component.onCompleted: {         for(a = 0 ; a < 100 ; a++)             someNumbersModel.append({ "location": String(a) })     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles