| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QBOXSET_H |
| 5 | #define QBOXSET_H |
| 6 | |
| 7 | #include <QtCharts/qchartglobal.h> |
| 8 | #include <QtGui/qpen.h> |
| 9 | #include <QtGui/qbrush.h> |
| 10 | #include <QtGui/qfont.h> |
| 11 | #include <QtCore/qobject.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | class QBoxSetPrivate; |
| 15 | |
| 16 | class Q_CHARTS_EXPORT QBoxSet : public QObject |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
| 20 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
| 21 | |
| 22 | public: |
| 23 | enum ValuePositions { |
| 24 | LowerExtreme, |
| 25 | LowerQuartile, |
| 26 | Median, |
| 27 | UpperQuartile, |
| 28 | UpperExtreme |
| 29 | }; |
| 30 | |
| 31 | public: |
| 32 | explicit QBoxSet(const QString label = QString(), QObject *parent = nullptr); |
| 33 | explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = nullptr); |
| 34 | virtual ~QBoxSet(); |
| 35 | |
| 36 | void append(const qreal value); |
| 37 | void append(const QList<qreal> &values); |
| 38 | |
| 39 | void clear(); |
| 40 | |
| 41 | void setLabel(const QString label); |
| 42 | QString label() const; |
| 43 | |
| 44 | QBoxSet &operator << (const qreal &value); |
| 45 | |
| 46 | void setValue(const int index, const qreal value); |
| 47 | qreal at(const int index) const; |
| 48 | qreal operator [](const int index) const; |
| 49 | int count() const; |
| 50 | |
| 51 | void setPen(const QPen &pen); |
| 52 | QPen pen() const; |
| 53 | |
| 54 | void setBrush(const QBrush &brush); |
| 55 | QBrush brush() const; |
| 56 | |
| 57 | Q_SIGNALS: |
| 58 | void clicked(); |
| 59 | void hovered(bool status); |
| 60 | void pressed(); |
| 61 | void released(); |
| 62 | void doubleClicked(); |
| 63 | void penChanged(); |
| 64 | void brushChanged(); |
| 65 | |
| 66 | void valuesChanged(); |
| 67 | void valueChanged(int index); |
| 68 | void cleared(); |
| 69 | |
| 70 | private: |
| 71 | QScopedPointer<QBoxSetPrivate> d_ptr; |
| 72 | Q_DISABLE_COPY(QBoxSet) |
| 73 | friend class BarLegendMarker; |
| 74 | friend class BarChartItem; |
| 75 | friend class BoxPlotChartItem; |
| 76 | friend class QBoxPlotSeriesPrivate; |
| 77 | }; |
| 78 | |
| 79 | QT_END_NAMESPACE |
| 80 | |
| 81 | #endif // QBOXSET_H |
| 82 | |