qml颜色渐变

来源:互联网 发布:天龙1000网络连接口 编辑:程序博客网 时间:2024/06/07 23:03
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    Rectangle {
        width: 500
        height: 400
        anchors.left: parent.left
        anchors.leftMargin: 70
        anchors.top: parent.top
        anchors.topMargin: 40
        //颜色渐变
        gradient:Gradient {
            GradientStop {position: 0.0; color: "green"}
            GradientStop {position: 0.5; color: "red"}
            GradientStop {position: 1.0; color: "gray"}
        }
    }
}
 
原创粉丝点击