Listview on Multitouch Device
-
Hello,
is it possible to use two Listview on a Multitoch device? I use two Listviews, bu it is not possible two scroll simultaneously. Heres a code example:
Rectangle { width: 480 height: 272 visible: true ListModel { id: model1 ListElement { name: "Bill Smith" number: "555 3264" } ListElement { name: "John Brown" number: "555 8426" } ListElement { name: "Sam Wise" number: "555 0473" } } ListView { id: lv1 anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom width: 240 model: model1 delegate: Text { text: name + ": " + number } } ListView { id: lv2 anchors.top: parent.top anchors.left: lv1.right anchors.right: parent.right anchors.bottom: parent.bottom width: 240 model: model1 delegate: Text { text: name + ": " + number } } }
I'd like to use both ListView Elements simultaneously, but have not found a way to do this.
Is there a way to do this?Best regards
Martin -
@winkler3523 I think you will need to use MultiPointTouchArea.
-
Hi,
you can link the twoListView
using thecontentY
property ofFlickable
type (which is inherited byListView
)
That way when you scrolllv1
alsolv2
scrolls:ListView { id: lv2 anchors.top: parent.top anchors.left: lv1.right anchors.right: parent.right anchors.bottom: parent.bottom width: 240 // add this binding contentY: lv1.contentY model: model1 delegate: Text { text: name + ": " + number } }
Of course they do not scroll independently!!
-
-
@winkler3523 Try by binding TouchPoint's
y
coordinate tocontentItem.y
ofListView
. But it doesn't seem straightforward. -
Hi,
thank you. I will give it try, although it seems not that straightforward. I have to check wich TouchPoint is over a listview and use its y coordinate to move the listview.
I also have seen this patch:
https://codereview.qt-project.org/#/c/65801/It is in the review state. It should solve the problem. I will also try this, because that would be a clean solution.
thanks
Martin -
@winkler3523 Good find. But it seems to be there from ages :) Vote it up.