Hi all,
I am trying to access the MouseArea.pressed signal as part of a chain of signals but have so far not been able to as there also exists a boolean property on MouseArea with the same name. Here’s a minimal test case you can run with qmlscene and observe the console output to see the problem.
import QtQuick 2.0
Rectangle {
id: root
color: '#CCCCCC'
width: 250
height: 150
Rectangle {
color: 'blue'
x: 50; y: 50; width: 50; height: 50;
MouseArea {
id: bluemouse
anchors.fill: parent
onClicked: {
console.log('click on blue');
redmouse.doubleClicked(mouse);
}
onPressed: {
console.log('pressed on blue');
}
}
}
Rectangle {
color: 'red'
x: 150; y: 50; width: 50; height: 50;
MouseArea {
id: redmouse
anchors.fill: parent
onClicked: {
console.log('click on red');
bluemouse.pressed(mouse);
}
onDoubleClicked: {
console.log('double on red');
}
}
}
Component.onCompleted: {
redmouse.pressAndHold.connect(redmouse.doubleClicked)
bluemouse.pressAndHold.connect(bluemouse.pressed) // <- Throws error
// bluemouse.pressed.connect(bluemouse.doubleClicked) <- Also throws error
}
}
Immediately on parsing there is an error in Component.onCompleted stating that bluemouse.pressed isn’t a function.
Then there is also an error when clicking on red where the signal isn’t forwarded to the bluemouse.pressed handler, though clicking on the blue will trigger redmouse.doubleClicked as expected.
Is there any workaround for this, or indeed is it something that should be submitted to the bug tracker?
Thanks
↧