[Qt-qml] MouseArea does not emit onPressed after being cancelled?
Bo Elmgreen
bo.elmgreen at gmail.com
Tue Oct 18 16:14:30 CEST 2011
Hi all,
I have run into a problem, that I could need some help with :o)
I am using an Image element for a button, see snippet below. I have
added a MouseArea and its onPressed and onReleased signals control
whether the user is "talking". Normally this works fine, but if some
event occurs, while the user is pressing the "button", so another
element is shown and "steals" the mouse events, onCanceled is emitted
from the MouseArea, but thereafter I cannot detect any presses on the
image - after the intruding element has been removed. I am pressing the
image, but no onPressed signal is emitted?
Am I doing something wrong or have I discovered a bug?
Thanks in advance!
Cheers,
Bo
Image{
id: pttButton
source: "images/PTT_button.png"
opacity: 0.4
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 15
}
enabled: false
visible: pttButtonShown
MouseArea {
id: pttButtonMouseArea
anchors.fill: parent
onPressed: { console.log("pttButtonMouseArea - onPressed"); thisView.callButtonPressed(); contactSelector.closeCallsList() }
onReleased: { console.log("pttButtonMouseArea - onReleased"); thisView.callButtonReleased() }
onCanceled: console.log("pttButtonMouseArea - onCanceled")
}
states: [
State {
name: "stateCallActive"
when: callManager.haveCurrentCall && !pttButtonMouseArea.pressed
PropertyChanges { target: pttButton; opacity: 1.0 }
PropertyChanges { target: pttButton; enabled: true }
},
State {
name: "stateCallActivePressed"
when: callManager.haveCurrentCall && pttButtonMouseArea.pressed
PropertyChanges { target: pttButton; opacity: 0.7 }
PropertyChanges { target: pttButton; enabled: true }
}
]
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111018/09df7854/attachment-0001.html
More information about the Qt-qml
mailing list