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. QtQuick 2.0 Two listviews and mouse
Qt 6.11 is out! See what's new in the release blog

QtQuick 2.0 Two listviews and mouse

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.2k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    braders2
    wrote on last edited by
    #1

    Hello guys,
    Today i have problem with two listviews and mouse. When I created two listviews, mouse operation like(scroll, click and drag) are active only on second listview. Can i change that mouse have impact on the firstly listview?

    Piece of code:
    @ ListView {
    id: listview1
    objectName: "listview"
    signal qmlSignal(string msg)
    clip: true
    y:200

            anchors.margins: 7
            anchors.fill: parent
            model: Menu  {}
    
            delegate: contactDelegate
            highlightFollowsCurrentItem:true
            highlight: Rectangle  {  color: "lightsteelblue"; radius: 5 }
            focus: true
          maximumFlickVelocity :listview1.contentHeight
            Behavior on contentY {
    
                        NumberAnimation {
                            //This specifies how long the animation takes
                            duration: 600
                            //This selects an easing curve to interpolate with, the default is Easing.Linear
                            easing.type: Easing.InSine
                        }
                    }
            Behavior on contentX {
    
                        NumberAnimation {
                            //This specifies how long the animation takes
                            duration: 600
                            //This selects an easing curve to interpolate with, the default is Easing.Linear
                            easing.type: Easing.InSine
                        }
                    }
            MouseArea{
    
               anchors.fill:parent
    
               onClicked: { listview1.qmlSignal(listview1.model.get(listview1.currentIndex).name)}
            }
    
    
        }
    
    
        
                ListView  {
                    id: listview2
                    objectName: "listview2"
                    signal qmlSignal(string msg)
                    clip: true
                    y:200
                    contentX:-200
                    anchors.margins: 7
                    anchors.fill: parent
                    model: Polska  {}
                    delegate: polska2_list
                    highlightFollowsCurrentItem:true
                    highlight: Rectangle  {  color: "lightsteelblue"; radius: 5 }
                    focus: true
    
    
    
                    Behavior on contentY {
    
                                NumberAnimation {
                                    //This specifies how long the animation takes
                                    duration: 600
                                    //This selects an easing curve to interpolate with, the default is Easing.Linear
                                    easing.type: Easing.InSine
                                }
                            }
                    Behavior on contentX {
    
                                NumberAnimation {
                                    //This specifies how long the animation takes
                                    duration: 600
                                    //This selects an easing curve to interpolate with, the default is Easing.Linear
                                    easing.type: Easing.InSine
                                }
                            }
                    MouseArea{
                       anchors.fill:parent
    
                      onClicked: { listview2.qmlSignal(listview2.model.get(listview2.currentIndex).name)}
                    }
    
    
                }@
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      braders2
      wrote on last edited by
      #2

      Problem fixed, i had to delete anchors.fill: parent from Listview1 and Listview2 :)

      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