1. 效果
-
横向
-
纵向
-
斜向
2. 代码
//渐变色背景
LinearGradient{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(width, 0) //横向
//end: Qt.point(0, height) //纵向
//end: Qt.point(width, height) //斜向
gradient: Gradient {
GradientStop { position: 0.0; color: "AliceBlue" }
GradientStop { position: 1.0; color: Qt.darker("royalblue", 0.8)}
}
}