QML提供了矩形控件ide
代碼以下:ui
import QtQuick 2.12 import QtQuick.Window 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle{ width: 120 height: 120 x:260 y:180 //color:"red" border.color: "black" border.width:3 radius: 10 //漸變色 //漸變色和color屬性只能用一個,否則屬性會被覆蓋 gradient: Gradient { GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop { position: 1.0; color: "blue" } } } }
更多例子能夠查看Qt助手3d