QML语法例子:单击MouseArea使Rectangle变换随机的颜色

来源:互联网 发布:邓亚萍 20亿 知乎 编辑:程序博客网 时间:2024/05/01 15:19
import QtQuick 2.2Rectangle {    id: rect    width: 100; height: 100    MouseArea {        anchors.fill: parent        onClicked: {            rect.color = Qt.rgba(Math.random(),                                 Math.random(), Math.random(), 1);        }    }}
知识点:信号与信号处理器特性(书P66)


0 0
原创粉丝点击