QPieSlice Class
QPieSlice 클래스는 파이 계열의 단일 슬라이스를 나타냅니다. 더 보기...
Header: | #include <QPieSlice> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
qmake: | QT += graphs |
QML에서: | PieSlice |
상속합니다: | QObject |
- 상속된 멤버를 포함한 모든 멤버의 목록
- QPieSlice는 Qt Graphs 2D용 C++ 클래스의 일부입니다.
공용 유형
enum class | LabelPosition { Outside, InsideHorizontal, InsideTangential, InsideNormal } |
속성
|
|
공공 기능
QPieSlice(QObject *parent = nullptr) | |
QPieSlice(const QString &label, qreal value, QObject *parent = nullptr) | |
virtual | ~QPieSlice() override |
qreal | angleSpan() const |
QColor | borderColor() const |
qreal | borderWidth() const |
QColor | color() const |
qreal | explodeDistanceFactor() const |
bool | isExploded() const |
bool | isLabelVisible() const |
QString | label() const |
qreal | labelArmLengthFactor() const |
QColor | labelColor() const |
QFont | labelFont() const |
QPieSlice::LabelPosition | labelPosition() |
qreal | percentage() const |
QPieSeries * | series() const |
void | setBorderColor(QColor color) |
void | setBorderWidth(qreal borderWidth) |
void | setColor(QColor color) |
void | setExplodeDistanceFactor(qreal factor) |
void | setExploded(bool exploded) |
void | setLabel(const QString &label) |
void | setLabelArmLengthFactor(qreal factor) |
void | setLabelColor(QColor color) |
void | setLabelFont(const QFont &font) |
void | setLabelPosition(QPieSlice::LabelPosition position) |
void | setLabelVisible(bool visible = true) |
void | setValue(qreal value) |
qreal | startAngle() const |
qreal | value() const |
신호
void | angleSpanChanged() |
void | borderColorChanged() |
void | borderWidthChanged() |
void | colorChanged() |
void | explodeDistanceFactorChanged() |
void | explodedChanged() |
void | labelArmLengthFactorChanged() |
void | labelChanged() |
void | labelColorChanged() |
void | labelFontChanged() |
void | labelPositionChanged() |
void | labelVisibleChanged() |
void | percentageChanged() |
void | startAngleChanged() |
void | valueChanged() |
상세 설명
파이 슬라이스에는 값과 레이블이 있습니다. 슬라이스가 파이 계열에 추가되면 QPieSeries 객체는 계열의 모든 슬라이스의 합과 비교하여 해당 슬라이스의 백분율을 계산하여 그래프에서 슬라이스의 실제 크기를 결정합니다.
기본적으로 레이블은 숨겨져 있습니다. 레이블이 표시되는 경우 슬라이스 외부에 위치하여 팔로 연결하거나 슬라이스 내부에 수평 또는 슬라이스 호의 접선 또는 법선과 평행하게 중앙에 위치할 수 있습니다.
기본적으로 슬라이스의 시각적 모양은 테마에 의해 설정되지만 슬라이스 속성을 지정하여 테마를 재정의할 수 있습니다. 그러나 슬라이스를 사용자 지정한 후에 테마를 변경하면 모든 사용자 지정이 손실됩니다.
사용자가 원형 그래프와 상호 작용할 수 있도록 사용자가 원형 슬라이스를 클릭하거나 마우스를 마우스오버하면 몇 가지 기본 신호가 방출됩니다.
QPieSeries 을참조하세요 .
멤버 유형 문서
enum class QPieSlice::LabelPosition
이 열거형은 슬라이스 레이블의 위치를 설명합니다.
상수 | 값 | 설명 |
---|---|---|
QPieSlice::LabelPosition::Outside | 0 | 레이블은 암으로 연결된 슬라이스 외부에 위치합니다. 이것이 기본값입니다. |
QPieSlice::LabelPosition::InsideHorizontal | 1 | 레이블은 슬라이스 내에서 중앙에 위치하며 수평으로 배치됩니다. |
QPieSlice::LabelPosition::InsideTangential | 2 | 레이블은 슬라이스 내에서 중앙에 위치하며 슬라이스 호의 접선과 평행이 되도록 회전합니다. |
QPieSlice::LabelPosition::InsideNormal | 3 | 레이블은 슬라이스 내에서 중앙에 위치하며 슬라이스 호의 법선과 평행이 되도록 회전됩니다. |
속성 문서
[read-only]
angleSpan : const qreal
이 속성은 슬라이스의 범위를 도 단위로 나타냅니다. 전체 파이는 360도이며 0도는 12시 방향입니다. 슬라이스가 시리즈에 추가되면 자동으로 업데이트됩니다.
기능에 액세스합니다:
qreal | angleSpan() const |
알림 신호:
void | angleSpanChanged() |
borderColor : QColor
이 속성에는 슬라이스 테두리를 그리는 데 사용되는 색상이 저장됩니다. 슬라이스를 수정할 때 편리하게 사용할 수 있는 속성입니다.
함수에 액세스합니다:
QColor | borderColor() const |
void | setBorderColor(QColor color) |
알림 신호:
void | borderColorChanged() |
borderWidth 를참조하세요 .
borderWidth : qreal
이 속성은 슬라이스 테두리의 너비를 보유합니다. 이 속성은 슬라이스 테두리 너비를 수정할 때 편리하게 사용할 수 있는 속성입니다.
함수에 액세스합니다:
qreal | borderWidth() const |
void | setBorderWidth(qreal borderWidth) |
알림 신호:
void | borderWidthChanged() |
borderColor 를참조하세요 .
color : QColor
이 속성은 슬라이스의 채우기 색을 저장합니다. 슬라이스 채우기 색상을 수정할 때 편리하게 사용할 수 있는 속성입니다.
함수에 액세스합니다:
QColor | color() const |
void | setColor(QColor color) |
알림 신호:
void | colorChanged() |
explodeDistanceFactor : qreal
슬라이스가 파이에서 얼마나 멀리 떨어져 폭발할지 결정합니다.
- 1.0은 거리가 반경과 같음을 의미합니다.
- 0.5는 거리가 반경의 절반임을 의미합니다.
기본적으로 거리는 0.15입니다.
기능에 액세스합니다:
qreal | explodeDistanceFactor() const |
void | setExplodeDistanceFactor(qreal factor) |
알림 신호:
void | explodeDistanceFactorChanged() |
exploded 을참조하세요 .
exploded : bool
이 속성은 슬라이스가 파이에서 분리되어 있는지 여부를 저장합니다.
액세스 함수:
bool | isExploded() const |
void | setExploded(bool exploded) |
알림 신호:
void | explodedChanged() |
explodeDistanceFactor 를참조하세요 .
label : QString
이 속성에는 슬라이스의 레이블이 저장됩니다.
참고: 문자열은 HTML 형식을 지정할 수 있습니다.
함수에 액세스합니다:
QString | label() const |
void | setLabel(const QString &label) |
알림 신호:
void | labelChanged() |
labelVisible, labelFont, labelArmLengthFactor 를참조하세요 .
labelArmLengthFactor : qreal
이 속성은 레이블 암의 길이를 보유합니다. 이 계수는 파이 반경에 상대적입니다. 예를 들어
- 1.0은 길이가 반지름과 같음을 의미합니다.
- 0.5는 길이가 반경의 절반임을 의미합니다.
기본적으로 암 길이는 0.15입니다.
기능에 액세스합니다:
qreal | labelArmLengthFactor() const |
void | setLabelArmLengthFactor(qreal factor) |
알림 신호:
void | labelArmLengthFactorChanged() |
label, labelVisible, labelFont 를참조하세요 .
labelColor : QColor
이 속성에는 슬라이스 레이블을 그리는 데 사용되는 색상이 저장됩니다.
함수에 액세스합니다:
QColor | labelColor() const |
void | setLabelColor(QColor color) |
알림 신호:
void | labelColorChanged() |
labelFont : QFont
이 속성에는 레이블 텍스트를 그리는 데 사용되는 글꼴이 저장됩니다.
함수에 액세스합니다:
QFont | labelFont() const |
void | setLabelFont(const QFont &font) |
알림 신호:
void | labelFontChanged() |
label, labelVisible, labelArmLengthFactor 를참조하세요 .
labelPosition : LabelPosition
이 속성은 슬라이스 레이블의 위치를 보유합니다.
기능에 액세스합니다:
QPieSlice::LabelPosition | labelPosition() |
void | setLabelPosition(QPieSlice::LabelPosition position) |
알림 신호:
void | labelPositionChanged() |
label 및 labelVisible 을참조하세요 .
labelVisible : bool
이 속성은 슬라이스 레이블의 표시 여부를 결정합니다. 기본적으로 레이블은 표시되지 않습니다.
기능에 액세스합니다:
bool | isLabelVisible() const |
void | setLabelVisible(bool visible = true) |
알림 신호:
void | labelVisibleChanged() |
label, labelFont, labelArmLengthFactor 를참조하세요 .
[read-only]
percentage : const qreal
이 속성은 계열의 모든 슬라이스의 합계와 비교한 슬라이스의 백분율을 보유합니다. 실제 값의 범위는 0.0에서 1.0입니다. 슬라이스가 시리즈에 추가되면 자동으로 업데이트됩니다.
기능에 액세스합니다:
qreal | percentage() const |
알림 신호:
void | percentageChanged() |
value 및 QPieSeries::sum 을참조하세요 .
[read-only]
startAngle : const qreal
이 속성은 이 슬라이스가 속한 계열에서 이 슬라이스의 시작 각도를 유지합니다. 전체 파이는 360도이며 0도는 12시 방향입니다. 슬라이스가 계열에 추가되면 자동으로 업데이트됩니다.
기능에 액세스합니다:
qreal | startAngle() const |
알림 신호:
void | startAngleChanged() |
value : qreal
이 속성은 슬라이스의 값을 보유합니다.
참고: 음수 값은 양수 값으로 변환됩니다.
함수에 액세스합니다:
qreal | value() const |
void | setValue(qreal value) |
알림 신호:
void | valueChanged() |
percentage() 및 QPieSeries::sum()도 참조하세요 .
멤버 함수 문서
[explicit]
QPieSlice::QPieSlice(QObject *parent = nullptr)
부모 parent 와 함께 빈 슬라이스를 구성합니다.
QPieSeries::append() 및 QPieSeries::insert()도 참조하세요 .
QPieSlice::QPieSlice(const QString &label, qreal value, QObject *parent = nullptr)
지정된 value, label, parent 로 빈 슬라이스를 생성합니다.
QPieSeries::append() 및 QPieSeries::insert()도 참조하십시오 .
[override virtual noexcept]
QPieSlice::~QPieSlice()
슬라이스를 제거합니다. 슬라이스가 시리즈에 추가된 경우 슬라이스를 제거해서는 안 됩니다.
QPieSeries *QPieSlice::series() const
이 슬라이스가 속한 계열을 반환합니다.
QPieSeries::append()도 참조하세요 .
© 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.