首页 > 其他分享 >qml教程-3-Item,Rectangle

qml教程-3-Item,Rectangle

时间:2022-10-09 16:33:31浏览次数:42  
标签:... console log Keys height Item qml 100 Rectangle


import QtQuick 2.15

Window {
width: 400
height: 600
visible: true

Rectangle {
x: 100
y: 100
width: 100
height: 100
color: "blue"
focus: true // 获取焦点,如果获取键盘的事件

MouseArea {
anchors.fill: parent
onClicked: {
console.log("clicked ...")
}
}

// 方向键 右侧
Keys.onRightPressed: {
console.log("right pressed ...")
}

// enter 会车键
Keys.onReturnPressed: {
console.log("return pressed ...")
}
}
}

qml教程-3-Item,Rectangle_vue.js


标签:...,console,log,Keys,height,Item,qml,100,Rectangle
From: https://blog.51cto.com/u_12836588/5740704

相关文章