Rectangle QML 类型

Paints a filled rectangle with optionally rounded corners. 更多...

导入语句: import QtQuick .
Since: Qt Quick Ultralite 1.0
继承:

Item

特性

详细描述

Rectangle items are used to fill areas with solid color.

外观

Each Rectangle item is painted using a solid fill color, specified using the color 特性。

You can also create rounded rectangles using the radius 特性。

用法范例

The following example shows a Rectangle item, which in this case is used to create a square with rounded corners.

import QtQuick 2.15
Rectangle {
    width: 100
    height: 100
    color: "red"
    radius: 10
}
						

另请参阅 图像 .

特性文档编制

color : color

This property holds the color used to fill the rectangle.

The default color is white.

The following example shows rectangles with colors specified using hexadecimal and named color notation:

Rectangle {
    color: "#00B000"
    width: 80; height: 80
}
Rectangle {
    color: "steelblue"
    y: 100; width: 80; height: 80
}
								


radius : real

This property holds the corner radius used to draw a rounded rectangle.

If radius is non-zero, the rectangle will be painted as a rounded rectangle, otherwise it will be painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners.