PieSlice QML Type
代表饼系列中的一个切片。更多
Import Statement: | import QtCharts 2.9 |
In C++: | QPieSlice |
属性
- 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
信号
- clicked()
- doubleClicked()
- hovered(bool state)
- pressed()
- released()
详细说明
饼切片有一个值和一个标签。当切片添加到饼系列中时,PieSeries 类型会计算切片与系列中所有切片总和的百分比,以确定图表中切片的实际大小。
默认情况下,标签是隐藏的。如果标签可见,它可以位于切片外部并用一条臂与之连接,也可以位于切片内部的中心位置,可以是水平方向,也可以是与切片圆弧的切线或法线平行的方向。
默认情况下,切片的视觉外观由主题设置,但可以通过指定切片属性来覆盖主题。不过,如果在自定义切片后更改主题,所有自定义功能都将丢失。
PieSlice 类型应作为PieSeries 类型的子类型使用。例如
另外,也可以使用PieSeries.append() 方法将切片添加到饼系列中。
在这种情况下,可以使用PieSeries.at() 或PieSeries.find 访问单个 PieSlice 实例的属性。
另请参阅 PieSeries 。
属性文档
angleSpan : real |
切片的跨度(度)。一个完整的派是 360 度,其中 0 度为 12 点钟方向。切片添加到系列后自动更新。
borderColor : color |
用于绘制切片边框的颜色(钢笔颜色)。
另请参阅 borderWidth 。
borderWidth : int |
切片边框的宽度。这是用于修改切片笔的方便属性。
另请参阅 borderColor 。
brushFilename : string |
用作切片笔刷的文件名。
color : color |
切片的填充(画笔)颜色。
exploded : bool |
切片是否与饼分离。
另请参阅 explodeDistanceFactor 。
label : string |
切片的标签。
注: 字符串可以是 HTML 格式。
labelArmLengthFactor : real |
labelColor : color |
用于绘制切片标签的颜色。
labelFont : font |
labelPosition : enumeration |
描述切片标签的位置。
常数 | 描述 |
---|---|
PieSlice.LabelOutside | 标签位于用臂连接的切片外部。这是默认值。 |
PieSlice.LabelInsideHorizontal | 标签位于切片中心,水平放置。 |
PieSlice.LabelInsideTangential | 标签位于切片中心,旋转后与切片圆弧的切线平行。 |
PieSlice.LabelInsideNormal | 标签在切片内居中,旋转后与切片圆弧的法线平行。 |
另请参阅 labelVisible 。
labelVisible : bool |
切片标签的可见性。默认情况下,标签不可见。
percentage : real |
切片占系列中所有切片总和的百分比。实际值从 0.0 到 1.0 不等。切片添加到系列后自动更新。
startAngle : real |
该切片在所属系列中的起始角度。一个完整的饼是 360 度,其中 0 度为 12 点钟方向。切片添加到系列后自动更新。
value : real |
切片的值。
注意: 负值会转换为正值。
信号文档
clicked() |
该信号在片段被点击时发出。
相应的信号处理程序是onClicked()
。
注: 相应的处理程序是onClicked
。
doubleClicked() |
用户双击切片时发出该信号。
相应的信号处理程序是onDoubleClicked()
。
注: 相应的处理程序是onDoubleClicked
。
hovered(bool state) |
当鼠标悬停在切片上时,会发出该信号。当鼠标移到切片上时,state 变成true
,当鼠标再次移开时,变成false
。
相应的信号处理程序是onHovered()
。
注: 相应的处理程序是onHovered
。
pressed() |
当用户点击切片并按住鼠标键时,会发出该信号。
相应的信号处理器是onPressed()
。
注: 相应的处理程序是onPressed
。
released() |
当用户松开按在切片上的鼠标键时,会发出该信号。
相应的信号处理器是onReleased()
。
注: 相应的处理程序是onReleased
。
© 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.