----- 信号 -----


 信号处理程序 
声明:on + Signal
例:onClicked: { }
示例
import QtQuick
import QtQuick.Controls
 
Rectangle {
    id: rect
    width: 250; height: 250
 
    //点击 Button 发出一个 clicked 信号
    //onClicked 接收此信号后,调用相应执行代码
    Button {
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        text: "Change color!"
        onClicked: {
            rect.color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1);
        }
    }
}


 属性更改信号处理程序 
当 QML 属性的值改变时,信号会自动发出。这种类型的信号是属性变化信号
声明:on + Signal + Changed 
例:onPressedChanged: { }
示例
import QtQuick
 
Rectangle {
    id: rect
    width: 250; height: 250
 
    //MouseArea 类型有一个pressed 属性
    //在该属性发生变化时接收通知
    TapHandler {  //点按处理程序
        onPressedChanged: console.log("taphandler pressed?", pressed)
    }
}


 信号参数 
可能有参数。要访问这些参数,应为处理程序分配一个函数。箭头函数和匿名函数都可以使用。
声明:on + Signal + Changed 
例:onPressedChanged: { }
示例


----- 属性 -----


 ??? 
 ??? 
 作用: ???
示例
Rectangle {
    id: topRect
    visible: true  //可见性
    onClicked: topRect.visible = !topRect.visible  //信号示例
    opacity: 0.5  //透明度
    radius: 8  //圆角
    gradient: Gradient {  //垂直渐变填充
        GradientStop { position: 0.0; color: "aqua" }  //position 位置
        GradientStop { position: 1.0; color: "teal" }
    }
    border {
        width: 3
        color: "white"
    }
}
 
/*----------资源文件----------*/
Image {
    x: 40
    y: 20
    width: 61
    height: 73
    source: "http://codereview.qt-project.org/static/logo_qt.png"
}
 
/*----------变换----------*/
Rectangle {
    x: 40
    y: 20
    width: 100
    height: 100
    rotation: 45  //旋转
    scale: 0.8  //缩放
}