Rectangle{
id:rect1
width: 100
height: 50
color: "black"
anchors.centerIn: parent
rotation: 30//旋转角度
scale: 2//放大为原来的2倍
antialiasing: true//抗锯齿(默认true)
//外边框
border.color: "red"
border.width: 2
//圆角
radius:5
//颜色渐变
gradient: Gradient{
GradientStop{position: 0.0;color: "lights teelblue"}
GradientStop{position: 1.0;color: "blue"}
}
}
QML-Rectangle 样式设置
本文详细描述了Rectangle对象在编程中如何设置宽度、高度、颜色、旋转、缩放、抗锯齿、边框、圆角以及颜色渐变等特性,展示了图形元素的创建和定制方法。
摘要由CSDN通过智能技术生成