| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QPIESLICE_P_H |
| 5 | #define QPIESLICE_P_H |
| 6 | |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the QtGraphs API. It exists purely as an |
| 11 | // implementation detail. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | |
| 16 | #include <QtCore/private/qobject_p.h> |
| 17 | #include <QtCore/qpoint.h> |
| 18 | #include <QtGraphs/qpieslice.h> |
| 19 | #include <QtGui/QColor> |
| 20 | #include <QtGui/QFont> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class QPieSeries; |
| 25 | class QQuickPathArc; |
| 26 | class QQuickPathLine; |
| 27 | class QQuickShape; |
| 28 | class QQuickShapePath; |
| 29 | class QQuickText; |
| 30 | |
| 31 | class QPieSlicePrivate : public QObjectPrivate |
| 32 | { |
| 33 | public: |
| 34 | QPieSlicePrivate(); |
| 35 | ~QPieSlicePrivate() override; |
| 36 | |
| 37 | void setPercentage(qreal percentage); |
| 38 | void setStartAngle(qreal angle); |
| 39 | void setAngleSpan(qreal span); |
| 40 | |
| 41 | private: |
| 42 | friend class QPieSeries; |
| 43 | friend class QPieSeriesPrivate; |
| 44 | friend class PieRenderer; |
| 45 | |
| 46 | void setLabelVisible(bool visible, bool forceHidden = false); |
| 47 | void setLabelPosition(QPieSlice::LabelPosition position); |
| 48 | |
| 49 | QString m_labelText; |
| 50 | bool m_isLabelVisible; |
| 51 | QPieSlice::LabelPosition m_labelPosition; |
| 52 | QColor m_color; |
| 53 | QColor m_labelColor; |
| 54 | QFont m_labelFont; |
| 55 | qreal m_labelArmLengthFactor; |
| 56 | qreal m_value; |
| 57 | qreal m_percentage; |
| 58 | qreal m_startAngle; |
| 59 | qreal m_angleSpan; |
| 60 | bool m_hideLabel; |
| 61 | bool m_isExploded; |
| 62 | qreal m_explodeDistanceFactor; |
| 63 | |
| 64 | bool m_labelDirty; |
| 65 | |
| 66 | QColor m_borderColor; |
| 67 | qreal m_borderWidth; |
| 68 | |
| 69 | QQuickShapePath *m_shapePath; |
| 70 | QQuickText *m_labelItem = nullptr; |
| 71 | QQuickShape *m_labelShape = nullptr; |
| 72 | QQuickShapePath *m_labelPath = nullptr; |
| 73 | |
| 74 | QPointF m_largeArc; |
| 75 | QPointF m_centerLine; |
| 76 | QPointF m_labelArm; |
| 77 | |
| 78 | QPieSeries *m_series = nullptr; |
| 79 | |
| 80 | Q_DECLARE_PUBLIC(QPieSlice) |
| 81 | }; |
| 82 | |
| 83 | QT_END_NAMESPACE |
| 84 | |
| 85 | #endif // QPIESLICE_P_H |
| 86 |
