PieSlice QML Type
代表饼系列中的一个切片。更多
Import Statement: | import QtGraphs |
In C++: | QPieSlice |
- 所有成员的列表,包括继承成员
- PieSlice 是Qt Graphs QML Types for 2D 的一部分。
属性
- angleSpan : real
- borderColor : color
- borderWidth : real
- color : color
- explodeDistanceFactor : real
- exploded : bool
- label : string
- labelArmLengthFactor : real
- labelColor : color
- labelFont : font
- labelPosition : enumeration
- labelVisible : bool
- percentage : real
- startAngle : real
- value : real
信号
- angleSpanChanged()
- borderColorChanged()
- borderWidthChanged()
- colorChanged()
- explodeDistanceFactorChanged()
- explodedChanged()
- labelArmLengthFactorChanged()
- labelChanged()
- labelColorChanged()
- labelFontChanged()
- labelFontChanged()
- labelPositionChanged()
- labelVisibleChanged()
- percentageChanged()
- startAngleChanged()
- valueChanged()
详细说明
饼片有一个值和一个标签。当切片被添加到饼系列中时,PieSeries 类型会计算切片与系列中所有切片总和的百分比,以确定图形中切片的实际大小。
默认情况下,标签是隐藏的。如果标签可见,它可以位于切片外侧并用一条臂与切片相连,也可以位于切片内侧的中心位置,可以水平放置,也可以与切片圆弧的切线或法线平行放置。
默认情况下,切片的视觉外观由主题设置,但可以通过指定切片属性来覆盖主题。不过,如果在自定义切片后更改主题,所有自定义功能都将丢失。
PieSlice 类型应作为PieSeries 类型的子类型使用。例如
PieSeries { PieSlice { label: "example" value: 1 } }
另外,也可以使用PieSeries.append() 方法将切片添加到饼系列中。
在这种情况下,可以使用PieSeries.at() 或PieSeries.find() 访问单个 PieSlice 实例的属性。
另请参阅 PieSeries 。
属性文档
angleSpan : real |
切片的跨度,单位为度。一个完整的派是 360 度,其中 0 度为 12 点钟方向。切片添加到系列后自动更新。
borderColor : color |
用于绘制切片边框的颜色。
另请参阅 borderWidth 。
borderWidth : real |
切片边框的宽度。这是一个方便修改切片边框宽度的属性。
另请参阅 borderColor 。
color : color |
切片的填充颜色。
exploded : bool |
切片是否与饼分离。
另请参阅 explodeDistanceFactor 。
label : string |
切片的标签。
注: 字符串可以是 HTML 格式。
labelArmLengthFactor : real |
labelColor : color |
用于绘制切片标签的颜色。
labelFont : font |
labelPosition : enumeration |
描述切片标签的位置。
常数 | 描述 |
---|---|
PieSlice.LabelPosition.Outside | 标签位于用臂连接的切片外部。这是默认值。 |
PieSlice.LabelPosition.InsideHorizontal | 标签位于切片中心,水平放置。 |
PieSlice.LabelPosition.InsideTangential | 标签在切片内居中,旋转后与切片圆弧的切线平行。 |
PieSlice.LabelPosition.InsideNormal | 标签在切片内居中,旋转后与切片圆弧的法线平行。 |
另请参阅 labelVisible 。
labelVisible : bool |
切片标签的可见性。默认情况下,标签不可见。
percentage : real |
切片占系列中所有切片总和的百分比。实际值从 0.0 到 1.0 不等。切片添加到系列后自动更新。
startAngle : real |
该切片在所属系列中的起始角度。一个完整的饼是 360 度,其中 0 度为 12 点钟方向。切片添加到系列后自动更新。
value : real |
切片的值。
注意: 负值会转换为正值。
信号文档
angleSpanChanged() |
borderColorChanged() |
borderWidthChanged() |
colorChanged() |
当切片颜色发生变化时,将发出此信号。
注: 相应的处理程序是onColorChanged
。
explodeDistanceFactorChanged() |
explodedChanged() |
labelArmLengthFactorChanged() |
labelChanged() |
labelColorChanged() |
labelFontChanged() |
labelFontChanged() |
labelPositionChanged() |
labelVisibleChanged() |
percentageChanged() |
startAngleChanged() |
valueChanged() |
© 2025 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.