自己博客中的代码可以在https://github.com/xixihaha331/QT_Repository中获取
1.Rectangle
属性:id;text;color;width;height;
border.color 边框颜色
border.width边框宽度
opacity 透明度
radius 绘制圆形
gradient 渐变色
1.1Rectangle示例
import QtQuick 2.8
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Rectangle example")
Item{
Rectangle{
width: 400
height: 400
border.color: "red"
border.width: 3
color: "green"
opacity: 0.3
radius: width/2
gradient:Gradient{
GradientStop{
position: 0.0
color: "green"
}
GradientStop{
position: 0.4
color: "yellow"
}
GradientStop{
position