PieSlice QML Type | Qt Charts 5.7

Qt 5.7 | Qt Charts | QML Types | PieSlice QML Type

Qt 5.7.0 Reference Documentation

# PieSlice QML Type

Defines a slice in pie series. More...

Import Statement: | import QtCharts 2.1
Instantiates: | QPieSlice

- List of all members, including inherited members

## Properties

- angleSpan : real
- borderColor : color
- borderWidth : int
- brushFilename : QString
- color : color
- explodeDistanceFactor : real
- exploded : bool
- label : string
- labelArmLengthFactor : real
- labelColor : color
- labelFont : Font
- labelPosition : LabelPosition
- labelVisible : bool
- percentage : real
- startAngle : real
- value : real

## Signals

- onAngleSpanChanged()
- onBorderColorChanged()
- onBorderWidthChanged()
- onClicked()
- onColorChanged()
- onDoubleClicked()
- onHovered(bool state)
- onLabelChanged()
- onLabelColorChanged()
- onLabelVisibleChanged()
- void onPercentageChanged()
- onPressed()
- onReleased()
- onStartAngleChanged()
- onValueChanged()

## Detailed Description

PieSlice defines the properties of a single slice in a PieSeries. The element should be used as a child for a PieSeries. For example:

          PieSeries {
              id: pieSeries
              PieSlice { label: "eaten"; value: 94.9 }
              PieSlice { label: "not yet eaten"; value: 5.1 }
          }

An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append method.

      pieSeries.append("don't care", 1.1);

In that case you may want to use PieSeries.at or PieSeries.find to access the properties of an individual PieSlice instance.

      pieSeries.at(0).exploded = true;

See also PieSeries.

## Property Documentation

angleSpan : real

Span of the slice in degrees. Full pie is 360 degrees where 0 degrees is at 12 a'clock. Updated automatically once the slice is added to the series.

borderColor : color

Color used to draw the slice border (pen color).

See also borderWidth.

borderWidth : int

Width of the slice border. This is a convenience property for modifying the slice pen.

See also borderColor.

brushFilename : QString

The name of the file used as a brush for the slice.

color : color

Fill (brush) color of the slice.

explodeDistanceFactor : real

When the slice is exploded this factor defines how far the slice is exploded away from the pie. The factor is relative to pie radius. For example: 1.0 means the distance is the same as the radius. 0.5 means the distance is half of the radius. By default the distance is is 0.15

See also exploded.

exploded : bool

If set to true the slice is "exploded" away from the pie.

See also explodeDistanceFactor.

label : string

Label (text) of the slice.

labelArmLengthFactor : real

Defines the length of the label arm. The factor is relative to pie radius. For example: 1.0 means the length is the same as the radius. 0.5 means the length is half of the radius. By default the arm length is 0.15

See also labelVisible.

labelColor : color

Color used to draw the slice label.

labelFont : Font

Defines the font used for slice label.

See the Qt documentation for more details of Font.

See also labelVisible and labelPosition.

labelPosition : LabelPosition

Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal, PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is PieSlice.LabelOutside.

See also labelVisible.

labelVisible : bool

Defines the visibility of slice label. By default the label is not visible.

percentage : real

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.

startAngle : real

Defines the starting angle of this slice in the series it belongs to. Full pie is 360 degrees where 0 degrees is at 12 a'clock. Updated automatically once the slice is added to the series.

value : real

Value of the slice. Note that if users sets a negative value it is converted to a positive value.

## Signal Documentation

onAngleSpanChanged()

This signal is emitted when the angle span of the slice has changed.

See also angleSpan.

onBorderColorChanged()

This signal is emitted when slice border color changes.

See also borderColor.

onBorderWidthChanged()

This signal is emitted when slice border width changes.

See also borderWidth.

onClicked()

This signal is emitted when user has clicked the slice.

onColorChanged()

This signal is emitted when slice color changes.

onDoubleClicked()

This signal is emitted when user has doubleclicked the slice.

onHovered(bool state)

This signal is emitted when user has hovered over or away from the slice. state is true when user has hovered over the slice and false when hover has moved away from the slice.

onLabelChanged()

This signal emitted when the slice label has been changed.

See also label.

onLabelColorChanged()

This signal is emitted when slice label color changes.

See also labelColor.

onLabelVisibleChanged()

This signal emitted when visibility of the slice label has changed.

See also labelVisible.

void onPercentageChanged()

This signal is emitted when the percentage of the slice has changed.

See also percentage.

onPressed()

This signal is emitted when user has pressed the slice.

onReleased()

This signal is emitted when user has released the slice.

onStartAngleChanged()

This signal is emitted when the starting angle f the slice has changed.

See also startAngle.

onValueChanged()

This signal is emitted when the slice value changes.

See also value.