ArcItem QML Type
An arc that ends at the specified position and uses the specified radius. More...
Import Statement: | import QtQuick.Studio.Components |
Since: | QtQuick.Studio.Components 1.0 |
Inherits: |
Properties
- alpha : real
- arcWidth : real
- begin : real
- capStyle : int
- dashOffset : alias
- dashPattern : alias
- end : real
- fillColor : alias
- gradient : alias
- joinStyle : int
- outlineArc : bool
- round : bool
- roundBegin : bool
- roundEnd : bool
- strokeColor : alias
- strokeStyle : int
- strokeWidth : alias
Detailed Description
An arc is specified by setting values in degrees for the begin and end properties. The arc can be just a line or a filled outline. The strokeColor, strokeWidth, and strokeStyle properties specify the appearance of the line or outline. The dashPattern and dashOffset properties specify the appearance of dashed lines.
The area between the arc's start and end points or the area inside the outline are painted using either a solid fill color, specified using the fillColor property, or a gradient, defined using one of the ShapeGradient subtypes and set using the gradient property. If both a color and a gradient are specified, the gradient is used.
To create an arc with an outline, set the outlineArc property to true
. The arcWidth property specifies the width of the arc outline, including the stroke. The width of the outline between the start and end points is calculated automatically.
The round, roundBegin, and roundEnd properties specify whether the end points of the arc outline have rounded caps. For an arc that does not have an outline, the capStyle property specifies whether the line ends are square or rounded.
Because an arc has curves, it may be appropriate to set the antialiasing
property that is inherited from Item to improve its appearance.
Example Usage
You can use the Arc component in Qt Design Studio to create different kinds of arcs.
The QML code looks as follows:
ArcItem { id: arc x: 667 y: 490 fillColor: "#00ffffff" capStyle: 32 end: 180 strokeWidth: 6 strokeColor: "#000000" } ArcItem { id: arcOutline x: 910 y: 490 strokeColor: "gray" arcWidth: 13 end: 180 fillColor: "light gray" antialiasing: true round: true outlineArc: true } ArcItem { id: circle x: 811 y: 490 fillColor: "#02ffffff" end: 360 strokeWidth: 5 strokeColor: "#000000" } ArcItem { id: circleOutline x: 1046 y: 490 antialiasing: false outlineArc: true round: true strokeColor: "gray" fillColor: "light gray" strokeWidth: 1 end: 360 }
Property Documentation
arcWidth : real |
The total width of an arc that has an outline, including the outline and fill.
The default value is 10.
See also strokeWidth.
begin : real |
The position in degrees where the arc begins.
The default value is 0.
To create a circle, set the value of begin
to 0 and the value of the end
to 360.
capStyle : int |
The cap style defines how the end points of lines are drawn using QPainter. The cap style only applies to lines with width 1 or greater. The cap style can be square
, flat
, or round
.
The default is Qt::SquareCap
See also QPen::capStyle().
dashOffset : alias |
The starting point of the dash pattern for the arc or arc outline.
The offset is measured in terms of the units used to specify the dash pattern. For example, a pattern where each stroke is four units long, followed by a gap of two units, will begin with the stroke when drawn as a line. However, if the dash offset is set to 4.0, any line drawn will begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of the gap.
The default value is 0.
See also QPen::setDashOffset().
dashPattern : alias |
The dash pattern of the arc border specified as the dashes and the gaps between them.
The dash pattern is specified in units of the pen's width. That is, a dash with the length 5 and width 10 is 50 pixels long.
Each dash is also subject to cap styles, and therefore a dash of 1 with square cap set will extend 0.5 pixels out in each direction resulting in a total width of 2.
The default value is (4, 2), meaning a dash of 4 * strokeWidth pixels followed by a space of 2 * strokeWidth pixels.
See also QPen::setDashPattern().
end : real |
The position in degrees where the arc ends.
The default value is 90.
To create a circle, set the value of end
to 360 and the value of the begin
to 0.
fillColor : alias |
The arc fill color.
A arc can be filled with a solid
color or with any of the linear
, radial
, or conical
gradients.
When set to transparent
, no filling occurs.
The default value is white
.
If the arc is just a line, the area between its begin and end points is filled. If the arc has an outline, the area within the outline is filled.
gradient : alias |
The gradient of the arc fill color.
By default, no gradient is enabled and the value is null. In this case, the fill uses a solid color based on the value of fillColor.
When set, fillColor is ignored and filling is done using one of the ShapeGradient subtypes.
joinStyle : int |
The join style is used to connect two border line segments.
Constant | Description |
---|---|
ShapePath.MiterJoin | The outer edges of the lines are extended to meet at an angle, and this area is filled. |
ShapePath.BevelJoin | The triangular notch between the two lines is filled. This is the default value. |
ShapePath.RoundJoin | A circular arc between the two lines is filled. |
See also Qt::PenJoinStyle.
outlineArc : bool |
Whether the arc has an outline.
See also arcWidth, round, roundBegin, and roundEnd.
round : bool |
Whether the arc outline end points have round caps.
The roundBegin and roundEnd properties can be used to specify the caps separately for the end points.
roundBegin : bool |
Whether the arc outline begins with a round cap.
See also Qt::PenCapStyle, round, and roundEnd.
roundEnd : bool |
Whether the arc outline ends with a round cap.
See also Qt::PenCapStyle, round, and roundBegin.
strokeColor : alias |
The color used to draw the border of the arc. When set to transparent
, no line is drawn. The default value is red
.
See also QColor.
strokeStyle : int |
The style of the arc stroke.
When set to None
, no stroke is drawn.
The stroke can be set to have a Solid
, Dash
, Dot
, Dash Dot
, or Dash Dot Dot
pattern.
The default value is Solid
.
strokeWidth : alias |
The width of the border of the arc. The default value is 4. A width of 1 creates a thin line. For no line, use a negative value or a transparent color.
Note: The width of the arc's border does not affect the geometry of the arc itself or its position relative to other items if anchors are used.
The border is rendered within the arc's boundaries.
The total width of an arc that has an outline (that is, the outline and the fill) is specified by arcWidth.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.