QML: как обращаться с мышью?
QML: как обращаться с мышью над событием на MouseArea? Может ли кто-нибудь дать простой пример или сказать, что не так с моей?
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()
}
}
Ответы
Ответ 1
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()
}
}