Hello,
I have such code:
StackView {
z: -1
id: contentView
anchors.fill: parent
initialItem: "my.qml"
}
MouseArea {
id: slideDetector
signal slided(int direction) // -1 left; 1 - right
z: 100
anchors.fill: parent
property int xCord : 0
property int slideSize: parent.width / 5
onPressed: {
xCord = mouse.x
console.log("onPressed: x: ", xCord)
// mouse.accepted = false
}
onReleased: {
var result = mouse.x - xCord
console.log("onReleased: x: ", mouse.x)
Math.abs(result)
if (result >= slideSize) {
slideDetector.slided(Math.sign(result))
}
mouse.accepted = false
}
onSlided: {
console.log("======= Detect sliding: ", direction)
}
}
currently, this code can detect slideing, but elements at the StackView isn’t active.
but if i uncomment “mouse.accepted = false” signal reseased not emmite, but elements in StackView – is active.
so, how can i mix this variant for expected results: StackView elements is active and sliding can be detected?
tnx a lot 4 answers
↧










