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 QBOXSET_H |
31 | #define QBOXSET_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 QBoxSetPrivate; |
40 | |
41 | class Q_CHARTS_EXPORT QBoxSet : public QObject |
42 | { |
43 | Q_OBJECT |
44 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
45 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
46 | |
47 | public: |
48 | enum ValuePositions { |
49 | LowerExtreme, |
50 | LowerQuartile, |
51 | Median, |
52 | UpperQuartile, |
53 | UpperExtreme |
54 | }; |
55 | |
56 | public: |
57 | explicit QBoxSet(const QString label = QString(), QObject *parent = nullptr); |
58 | explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = nullptr); |
59 | virtual ~QBoxSet(); |
60 | |
61 | void append(const qreal value); |
62 | void append(const QList<qreal> &values); |
63 | |
64 | void clear(); |
65 | |
66 | void setLabel(const QString label); |
67 | QString label() const; |
68 | |
69 | QBoxSet &operator << (const qreal &value); |
70 | |
71 | void setValue(const int index, const qreal value); |
72 | qreal at(const int index) const; |
73 | qreal operator [](const int index) const; |
74 | int count() const; |
75 | |
76 | void setPen(const QPen &pen); |
77 | QPen pen() const; |
78 | |
79 | void setBrush(const QBrush &brush); |
80 | QBrush brush() const; |
81 | |
82 | Q_SIGNALS: |
83 | void clicked(); |
84 | void hovered(bool status); |
85 | void pressed(); |
86 | void released(); |
87 | void doubleClicked(); |
88 | void penChanged(); |
89 | void brushChanged(); |
90 | |
91 | void valuesChanged(); |
92 | void valueChanged(int index); |
93 | void cleared(); |
94 | |
95 | private: |
96 | QScopedPointer<QBoxSetPrivate> d_ptr; |
97 | Q_DISABLE_COPY(QBoxSet) |
98 | friend class BarLegendMarker; |
99 | friend class BarChartItem; |
100 | friend class BoxPlotChartItem; |
101 | friend class QBoxPlotSeriesPrivate; |
102 | }; |
103 | |
104 | QT_CHARTS_END_NAMESPACE |
105 | |
106 | #endif // QBOXSET_H |
107 | |