Author: DriverMonkey
QQ:196568501
Mail:bookworepeng@Hotmail.com
visible: true
width: 640
height: 480
title: qsTr("Hello World")
property color preColor: "red"
property color nextColor: preColor
onPreColorChanged:
{
console.log("precolor changed!")
}
onNextColorChanged:
{
console.log("nex color change!")
}
Rectangle{
color: root.preColor
x: 20; y: 20; width: 100; height: 100
MouseArea{
property int counter: 0
anchors.fill: parent
onClicked: {
root.preColor = "blue"
counter++
if(counter % 2 == 1)
{
root.preColor = "blue"
}else
{
root.preColor = "red"
}
}
}
}
Rectangle{
color : root.nextColor
x: 100; y: 100; width: 100; height: 100
MouseArea{
property int counter: 0
anchors.fill: parent
onClicked: {
counter++
if(counter % 2 == 1)
{
root.nextColor = "blue"
}else
{
root.nextColor = "red"
}
}
}
}
}