QtQuick 2.0 Two listviews and mouse



  • 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)}
                    }
    
    
                }@


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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.