elmgreen
20th October 2011, 10:28
Hi all,
I have run into a problem, that I could need some help with :)
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.presse
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 }
}
]
}
I have run into a problem, that I could need some help with :)
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.presse
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 }
}
]
}