1 | /* |
2 | * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> |
3 | * |
4 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef BARCHARTNODE_H |
8 | #define BARCHARTNODE_H |
9 | |
10 | #include <QColor> |
11 | #include <QSGGeometryNode> |
12 | |
13 | struct Bar { |
14 | float x; |
15 | float width; |
16 | float value; |
17 | QColor color; |
18 | }; |
19 | |
20 | class BarChartNode : public QSGNode |
21 | { |
22 | public: |
23 | BarChartNode(); |
24 | |
25 | void setRect(const QRectF &rect); |
26 | void setBars(const QList<Bar> &bars); |
27 | void setRadius(qreal radius); |
28 | void setBackgroundColor(const QColor &color); |
29 | void update(); |
30 | |
31 | private: |
32 | QRectF m_rect; |
33 | QList<Bar> m_bars; |
34 | qreal m_radius = 0.0; |
35 | QColor m_backgroundColor = Qt::transparent; |
36 | }; |
37 | |
38 | #endif // BARCHARTNODE_H |
39 | |