Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Listview on Multitouch Device
QtWS25 Last Chance

Listview on Multitouch Device

Scheduled Pinned Locked Moved QML and Qt Quick
listviewmultitouch
7 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    winkler3523
    wrote on last edited by winkler3523
    #1

    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

    p3c0P S 2 Replies Last reply
    0
    • W winkler3523

      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

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @winkler3523 I think you will need to use MultiPointTouchArea.

      157

      1 Reply Last reply
      0
      • W winkler3523

        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

        S Offline
        S Offline
        synasius
        wrote on last edited by synasius
        #3

        Hi,
        you can link the two ListView using the contentY property of Flickable type (which is inherited by ListView)
        That way when you scroll lv1 also lv2 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!!

        1 Reply Last reply
        0
        • W Offline
          W Offline
          winkler3523
          wrote on last edited by
          #4

          Hi,

          @p3c0: i have used the MultiPointTouchArea in my project, but i have no idea how to use it to scroll the Listviews indepentently. Any suggestions?

          @synasius: it is nessesary to scroll the Listviewss indenpentently so i can not use this apporch.

          regards

          p3c0P 1 Reply Last reply
          0
          • W winkler3523

            Hi,

            @p3c0: i have used the MultiPointTouchArea in my project, but i have no idea how to use it to scroll the Listviews indepentently. Any suggestions?

            @synasius: it is nessesary to scroll the Listviewss indenpentently so i can not use this apporch.

            regards

            p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            @winkler3523 Try by binding TouchPoint's y coordinate to contentItem.y of ListView. But it doesn't seem straightforward.

            157

            1 Reply Last reply
            0
            • W Offline
              W Offline
              winkler3523
              wrote on last edited by winkler3523
              #6

              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

              p3c0P 1 Reply Last reply
              0
              • W winkler3523

                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

                p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #7

                @winkler3523 Good find. But it seems to be there from ages :) Vote it up.

                157

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved