That's quite easy. You don't need any extra javascript files for this...
import QtQuick 1.1
Rectangle {
id: root
width: 600
height: 400
property int score: 0
Text {
id: txt
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 16
text: score
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: txt.bottom
anchors.bottom: parent.bottom
color: "lightyellow"
Rectangle {
width: 100
height: 100
radius: width/2
anchors.centerIn: parent
color: "blue"
MouseArea {
anchors.fill: parent
hoverEnabled: true
onExited: root.score = root.score+1
}
}
}
}
import QtQuick 1.1
Rectangle {
id: root
width: 600
height: 400
property int score: 0
Text {
id: txt
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 16
text: score
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: txt.bottom
anchors.bottom: parent.bottom
color: "lightyellow"
Rectangle {
width: 100
height: 100
radius: width/2
anchors.centerIn: parent
color: "blue"
MouseArea {
anchors.fill: parent
hoverEnabled: true
onExited: root.score = root.score+1
}
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks