Hi all,

I have a ListView which has some items inside. What I want is when the user clicked on items, the MouseArea in items can be triggered first. (since the items appear upper layer than ListView, I think it's resonable that we expect item's MouseArea receive mouse event first.) However, my experiment shows that MouseArea in ListViews receive mouse event first. Even I tried to set z value, ListViews always has higher priority to receive mouse event.
Does anyone who knows how I can make MouseArea in items to receive mouse event first?

Qt Code:
  1. import QtQuick 2.4
  2. import QtQuick.Controls 1.3
  3. import QtQuick.Window 2.2
  4.  
  5. ApplicationWindow {
  6. title: qsTr("Hello World")
  7. width: 1280
  8. height: 720
  9. visible: true
  10.  
  11. ListView{
  12. id: thisListView
  13. width: parent.width; height: parent.height
  14. delegate: thisDelegate
  15. model: thisListModel
  16. spacing: 2
  17. z:0
  18.  
  19. MouseArea{
  20. z:0
  21. anchors.fill: parent
  22. propagateComposedEvents: true
  23. onClicked: {
  24. console.log("ListView is clicked")
  25. mouse.accepted = false
  26. }
  27. }
  28. }
  29. ListModel{
  30. id: thisListModel
  31. ListElement{itemText: "1"}
  32. ListElement{itemText: "2"}
  33. ListElement{itemText: "3"}
  34. }
  35.  
  36. Component{
  37. id: thisDelegate
  38. Rectangle{
  39. width: thisListView.width; height: 30;
  40. color: "lightBlue"
  41. z: 1
  42. Text{text: itemText; anchors.centerIn: parent}
  43. MouseArea{
  44. z:1
  45. anchors.fill: parent
  46. onClicked: {
  47. console.log("Item is clicked")
  48. }
  49. }
  50. }
  51. }
  52. }
To copy to clipboard, switch view to plain text mode