import QtQuick 2.5
import QtQuick.Window 2.2
/*组件发出信号:
定义一个引用引用内部元素到外部: property alias cellColor: rectangle.color
定义信号: signal clicked(color cellCollr)
onClicked: clikcked(cellColor.color)*/
Window {
visible: true
width: 640
height: 480
Text{
id: helloText
text: "Helloworld"
y: 30
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: 24
MouseArea{
id:mouseArea
anchors.fill: parent
}
states: State{
name: "down"; when: mouseArea.pressed === true
PropertyChanges { //属性改变
target:helloText;
y:160;rotation:180 // 旋转
color:"red"
}
}
transitions: Transition{ // 过度
from: ""; to: "down";reversible: true //可逆的 还原原来状态
ParallelAnimation{ //平行的 动画
NumberAnimation{property: "y,rotation";duration: 500; easing.type: Easing.InOutQuad} //放松
ColorAnimation {duration: 500 }
}
}
}
}