You can try something similar for your specific case:
Rectangle { MouseArea { id: mouseAreaTop anchors.fill: parent OnClicked: { } } TextEdit { } }
Please note that I ordered them. All children will have a higher z than the parent. Siblings following later in the tree for the parent have higher z values.
The general idea is this:
- Identify all areas of the mouse.
- Sort them by z
Read about the z properties here in the Qt documentation , you can understand how to arrange the mouse areas.
eg:
Parent { anchors.fill: parent child1 { anchors.fill: parent z: 2 } child2 { anchors.fill: parent z: 1 } child3 { anchors.fill: parent z: 4 } child4 { anchors.fill: parent z: 3 } }
In this example, I redefined the natural order by assigning z values ββto myself.
source share