1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 or (at your option) any later version |
20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
22 | ** included in the packaging of this file. Please review the following |
23 | ** information to ensure the GNU General Public License requirements will |
24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
25 | ** |
26 | ** $QT_END_LICENSE$ |
27 | ** |
28 | ****************************************************************************/ |
29 | |
30 | #ifndef QBARSET_H |
31 | #define QBARSET_H |
32 | |
33 | #include <QtCharts/QChartGlobal> |
34 | #include <QtGui/QPen> |
35 | #include <QtGui/QBrush> |
36 | #include <QtGui/QFont> |
37 | |
38 | QT_CHARTS_BEGIN_NAMESPACE |
39 | class QBarSetPrivate; |
40 | |
41 | class Q_CHARTS_EXPORT QBarSet : public QObject |
42 | { |
43 | Q_OBJECT |
44 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) |
45 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
46 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
47 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) |
48 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) |
49 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
50 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
51 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) |
52 | |
53 | public: |
54 | explicit QBarSet(const QString label, QObject *parent = nullptr); |
55 | virtual ~QBarSet(); |
56 | |
57 | void setLabel(const QString label); |
58 | QString label() const; |
59 | |
60 | void append(const qreal value); |
61 | void append(const QList<qreal> &values); |
62 | |
63 | QBarSet &operator << (const qreal &value); |
64 | |
65 | void insert(const int index, const qreal value); |
66 | void remove(const int index, const int count = 1); |
67 | void replace(const int index, const qreal value); |
68 | qreal at(const int index) const; |
69 | qreal operator [](const int index) const; |
70 | int count() const; |
71 | qreal sum() const; |
72 | |
73 | void setPen(const QPen &pen); |
74 | QPen pen() const; |
75 | |
76 | void setBrush(const QBrush &brush); |
77 | QBrush brush() const; |
78 | |
79 | void setLabelBrush(const QBrush &brush); |
80 | QBrush labelBrush() const; |
81 | |
82 | void setLabelFont(const QFont &font); |
83 | QFont labelFont() const; |
84 | |
85 | QColor color(); |
86 | void setColor(QColor color); |
87 | |
88 | QColor borderColor(); |
89 | void setBorderColor(QColor color); |
90 | |
91 | QColor labelColor(); |
92 | void setLabelColor(QColor color); |
93 | |
94 | Q_SIGNALS: |
95 | void clicked(int index); |
96 | void hovered(bool status, int index); |
97 | void pressed(int index); |
98 | void released(int index); |
99 | void doubleClicked(int index); |
100 | void penChanged(); |
101 | void brushChanged(); |
102 | void labelChanged(); |
103 | void labelBrushChanged(); |
104 | void labelFontChanged(); |
105 | void colorChanged(QColor color); |
106 | void borderColorChanged(QColor color); |
107 | void labelColorChanged(QColor color); |
108 | |
109 | void valuesAdded(int index, int count); |
110 | void valuesRemoved(int index, int count); |
111 | void valueChanged(int index); |
112 | |
113 | private: |
114 | QScopedPointer<QBarSetPrivate> d_ptr; |
115 | Q_DISABLE_COPY(QBarSet) |
116 | friend class QAbstractBarSeries; |
117 | friend class BarLegendMarker; |
118 | friend class AbstractBarChartItem; |
119 | friend class QAbstractBarSeriesPrivate; |
120 | friend class StackedBarChartItem; |
121 | friend class PercentBarChartItem; |
122 | friend class BarChartItem; |
123 | friend class HorizontalBarChartItem; |
124 | friend class HorizontalStackedBarChartItem; |
125 | friend class HorizontalPercentBarChartItem; |
126 | friend class BoxPlotChartItem; |
127 | }; |
128 | |
129 | QT_CHARTS_END_NAMESPACE |
130 | |
131 | #endif // QBARSET_H |
132 | |