import QtQuick 2.12
import QtQuick.Window 2.12
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Rectangle {
width: parent.width / 2
height: parent.height / 2
color: 'red'
MouseArea {
anchors.fill: parent
hoverEnabled: true // 激活鼠标盘旋事件,否则无法检测鼠标进入离开
onEntered: {
console.log(' entry')
}
onExited: {
console.log(' leave')
}
}
}
}
qml鼠标进入离开事件
最新推荐文章于 2023-07-13 18:54:24 发布