[Qt-qml] MouseArea does not emit onPressed after being cancelled? II
Bo Elmgreen
bo.elmgreen at gmail.com
Mon Oct 24 02:18:53 CEST 2011
Hi all,
I have now made a small test application, where the problem can be
reproduced, please see the attached file. It can be run in the QML Viewer.
If you press the blue "button" and wait 5 seconds, a new "window" is
shown and in the console log you can see that the button has been
"cancelled". Now press "Acknowledge" to dismiss the new window and then
the blue button is not working any more; no signals are sent when you
press and release it. It is first after the new window has been
displayed and removed again, that the button starts working again.
I found out that the pre-requisite for the problem to occur is, that the
rectangle, where the button is located, is disabled (i.e. its "enabled"
property is set to false) when the new window is displayed.
To me it seems like a bug? Or can I get around this?
Thanks,
Bo
-------- Original Message --------
Subject: MouseArea does not emit onPressed after being cancelled?
Date: Tue, 18 Oct 2011 16:14:30 +0200
From: Bo Elmgreen <bo.elmgreen at gmail.com>
To: qt-qml at qt.nokia.com
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/20111024/ca0b2e81/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MouseAreaTest.zip
Type: application/x-zip-compressed
Size: 2086 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111024/ca0b2e81/attachment.bin
More information about the Qt-qml
mailing list