File indexing completed on 2024-05-19 03:59:18
0001 /* 0002 * This file is part of KQuickCharts 0003 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef PIECHARTNODE_H 0009 #define PIECHARTNODE_H 0010 0011 #include <QColor> 0012 #include <QSGGeometryNode> 0013 0014 class QRectF; 0015 class PieChartMaterial; 0016 0017 /** 0018 * @todo write docs 0019 */ 0020 class PieChartNode : public QSGGeometryNode 0021 { 0022 public: 0023 PieChartNode(); 0024 0025 /** 0026 * Default constructor 0027 */ 0028 explicit PieChartNode(const QRectF &rect); 0029 0030 /** 0031 * Destructor 0032 */ 0033 ~PieChartNode(); 0034 0035 void setRect(const QRectF &rect); 0036 void setInnerRadius(qreal radius); 0037 void setOuterRadius(qreal radius); 0038 void setSections(const QList<qreal> §ions); 0039 void setColors(const QList<QColor> &colors); 0040 void setBackgroundColor(const QColor &color); 0041 void setFromAngle(qreal angle); 0042 void setToAngle(qreal angle); 0043 void setSmoothEnds(bool smooth); 0044 0045 private: 0046 void updateTriangles(); 0047 0048 QRectF m_rect; 0049 qreal m_innerRadius = 0.0; 0050 qreal m_outerRadius = 0.0; 0051 QColor m_backgroundColor; 0052 qreal m_fromAngle = 0.0; 0053 qreal m_toAngle = 360.0; 0054 bool m_smoothEnds = false; 0055 0056 QList<qreal> m_sections; 0057 QList<QColor> m_colors; 0058 0059 QSGGeometry *m_geometry = nullptr; 0060 PieChartMaterial *m_material = nullptr; 0061 }; 0062 0063 #endif // PIECHARTNODE_H