QML: how to handle mouse over event on MouseArea? Can any one provide simple example or say what is wrong with mine?
import QtQuick 1.1
Image {
source: "quit.png"
scale: mouseArea.containsMouse ? 0.8 : 1.0
smooth: quitMouse.containsMouse
MouseArea {
id: quitMouse
anchors.fill: parent
anchors.margins: -10
onClicked: Qt.quit()
}
}
import QtQuick 1.1
Image {
source: "quit.png"
scale: mouseArea.containsMouse ? 0.8 : 1.0
smooth: mouseArea.containsMouse
MouseArea {
id: mouseArea
anchors.fill: parent
anchors.margins: -10
hoverEnabled: true //this line will enable mouseArea.containsMouse
onClicked: Qt.quit()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With