import QtQuick 2.2
import QtQuick.Controls 1.1
Text
{
id: label
x: 24
y: 24
//here
property int spacePresses: 0
text: "Space pressed: " + spacePresses + " times"
onTextChanged: console.log("text changed to:", text)
focus: true
Keys.onSpacePressed:
{
increment()
}
Keys.onEscapePressed:
{
label.text = ''
}
//! 这是一个js函数
function increment()
{
spacePresses = spacePresses + 1
}
}