PieSlice QML Type
Represents a single slice in a pie series. More...
Import Statement: | import QtCharts 2.15 |
Instantiates: | QPieSlice |
Properties
- angleSpan : real
- borderColor : color
- borderWidth : int
- brushFilename : string
- color : color
- explodeDistanceFactor : real
- exploded : bool
- label : string
- labelArmLengthFactor : real
- labelColor : color
- labelFont : font
- labelPosition : enumeration
- labelVisible : bool
- percentage : real
- startAngle : real
- value : real
Signals
- clicked()
- doubleClicked()
- hovered(bool state)
- pressed()
- released()
Detailed Description
A pie slice has a value and a label. When the slice is added to a pie series, the PieSeries type calculates the percentage of the slice compared with the sum of all slices in the series to determine the actual size of the slice in the chart.
By default, the label is hidden. If it is visible, it can be either located outside the slice and connected to it with an arm or centered inside the slice either horizontally or in parallel with the tangential or normal of the slice's arc.
By default, the visual appearance of the slice is set by a theme, but the theme can be overridden by specifying slice properties. However, if the theme is changed after the slices are customized, all customization will be lost.
The PieSlice type should be used as a child of a PieSeries type. For example:
PieSeries { id: pieSeries PieSlice { label: "eaten"; value: 94.9 } PieSlice { label: "not yet eaten"; value: 5.1 } }
Alternatively, slices can be added to a pie series by using the PieSeries.append() method.
pieSeries.append("don't care", 1.1);
In that case, PieSeries.at() or PieSeries.find can be used to access the properties of an individual PieSlice instance.
pieSeries.at(0).exploded = true;
See also PieSeries.
Property Documentation
The span of the slice in degrees. A full pie is 360 degrees, where 0 degrees is at 12 a'clock. Updated automatically once the slice is added to the series.
The color used to draw the slice border (pen color).
See also borderWidth.
The width of the slice border. This is a convenience property for modifying the slice pen.
See also borderColor.
Determines how far away from the pie the slice is exploded.
- 1.0 means that the distance is the same as the radius.
- 0.5 means that the distance is half of the radius.
By default, the distance is 0.15
See also exploded.
Whether the slice is separated from the pie.
See also explodeDistanceFactor.
The length of the label arm. The factor is relative to the pie radius. For example:
- 1.0 means that the length is the same as the radius.
- 0.5 means that the length is half of the radius.
By default, the arm length is 0.15
See also labelVisible.
The font used for the slice label.
For more information, see font.
See also labelVisible and labelPosition.
Describes the position of the slice label.
Constant | Description |
---|---|
PieSlice.LabelOutside | The label is located outside the slice connected to it with an arm. This is the default value. |
PieSlice.LabelInsideHorizontal | The label is centered within the slice and laid out horizontally. |
PieSlice.LabelInsideTangential | The label is centered within the slice and rotated to be parallel with the tangential of the slice's arc. |
PieSlice.LabelInsideNormal | The label is centered within the slice and rotated to be parallel with the normal of the slice's arc. |
See also labelVisible.
The percentage of the slice compared to the sum of all slices in the series. The actual value ranges from 0.0 to 1.0. Updated automatically once the slice is added to the series.
The starting angle of this slice in the series it belongs to. A full pie is 360 degrees, where 0 degrees is at 12 a'clock. Updated automatically once the slice is added to the series.
Signal Documentation
This signal is emitted when the slice is clicked.
The corresponding signal handler is onClicked()
.
Note: The corresponding handler is onClicked
.
This signal is emitted when user double-clicks the slice.
The corresponding signal handler is onDoubleClicked()
.
Note: The corresponding handler is onDoubleClicked
.
This signal is emitted when a mouse is hovered over the slice. When the mouse moves over the slice, state turns true
, and when the mouse moves away again, it turns false
.
The corresponding signal handler is onHovered()
.
Note: The corresponding handler is onHovered
.
This signal is emitted when user clicks the slice and holds down the mouse button.
The corresponding signal handler is onPressed()
.
Note: The corresponding handler is onPressed
.
This signal is emitted when the user releases the mouse press on the slice.
The corresponding signal handler is onReleased()
.
Note: The corresponding handler is onReleased
.