| 1 | // Copyright (C) 2016 The Qt Company Ltd. | 
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 |  | 
| 4 | #ifndef QBARSET_H | 
| 5 | #define QBARSET_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 QBarSetPrivate; | 
| 15 |  | 
| 16 | class Q_CHARTS_EXPORT QBarSet : public QObject | 
| 17 | { | 
| 18 |     Q_OBJECT | 
| 19 |     Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) | 
| 20 |     Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) | 
| 21 |     Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) | 
| 22 |     Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) | 
| 23 |     Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) | 
| 24 |     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | 
| 25 |     Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | 
| 26 |     Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | 
| 27 |  | 
| 28 | public: | 
| 29 |     explicit QBarSet(const QString label, QObject *parent = nullptr); | 
| 30 |     virtual ~QBarSet(); | 
| 31 |  | 
| 32 |     void setLabel(const QString label); | 
| 33 |     QString label() const; | 
| 34 |  | 
| 35 |     void append(const qreal value); | 
| 36 |     void append(const QList<qreal> &values); | 
| 37 |  | 
| 38 |     QBarSet &operator << (const qreal &value); | 
| 39 |  | 
| 40 |     void insert(const int index, const qreal value); | 
| 41 |     void remove(const int index, const int count = 1); | 
| 42 |     void replace(const int index, const qreal value); | 
| 43 |     qreal at(const int index) const; | 
| 44 |     qreal operator [](const int index) const; | 
| 45 |     int count() const; | 
| 46 |     qreal sum() const; | 
| 47 |  | 
| 48 |     void setPen(const QPen &pen); | 
| 49 |     QPen pen() const; | 
| 50 |  | 
| 51 |     void setBrush(const QBrush &brush); | 
| 52 |     QBrush brush() const; | 
| 53 |  | 
| 54 |     void setLabelBrush(const QBrush &brush); | 
| 55 |     QBrush labelBrush() const; | 
| 56 |  | 
| 57 |     void setLabelFont(const QFont &font); | 
| 58 |     QFont labelFont() const; | 
| 59 |  | 
| 60 |     QColor color(); | 
| 61 |     void setColor(QColor color); | 
| 62 |  | 
| 63 |     QColor borderColor(); | 
| 64 |     void setBorderColor(QColor color); | 
| 65 |  | 
| 66 |     QColor labelColor(); | 
| 67 |     void setLabelColor(QColor color); | 
| 68 |  | 
| 69 |     QColor selectedColor() const; | 
| 70 |     void setSelectedColor(const QColor &color); | 
| 71 |  | 
| 72 |     bool isBarSelected(int index) const; | 
| 73 |     void selectBar(int index); | 
| 74 |     void deselectBar(int index); | 
| 75 |     void setBarSelected(int index, bool selected); | 
| 76 |     void selectAllBars(); | 
| 77 |     void deselectAllBars(); | 
| 78 |     void selectBars(const QList<int> &indexes); | 
| 79 |     void deselectBars(const QList<int> &indexes); | 
| 80 |     void toggleSelection(const QList<int> &indexes); | 
| 81 |     QList<int> selectedBars() const; | 
| 82 |  | 
| 83 | Q_SIGNALS: | 
| 84 |     void clicked(int index); | 
| 85 |     void hovered(bool status, int index); | 
| 86 |     void pressed(int index); | 
| 87 |     void released(int index); | 
| 88 |     void doubleClicked(int index); | 
| 89 |     void penChanged(); | 
| 90 |     void brushChanged(); | 
| 91 |     void labelChanged(); | 
| 92 |     void labelBrushChanged(); | 
| 93 |     void labelFontChanged(); | 
| 94 |     void colorChanged(QColor color); | 
| 95 |     void borderColorChanged(QColor color); | 
| 96 |     void labelColorChanged(QColor color); | 
| 97 |     Q_REVISION(6, 2) void selectedColorChanged(const QColor &color); | 
| 98 |  | 
| 99 |     void valuesAdded(int index, int count); | 
| 100 |     void valuesRemoved(int index, int count); | 
| 101 |     void valueChanged(int index); | 
| 102 |  | 
| 103 |     Q_REVISION(6, 2) void selectedBarsChanged(const QList<int> &indexes); | 
| 104 |  | 
| 105 | private: | 
| 106 |     QScopedPointer<QBarSetPrivate> d_ptr; | 
| 107 |     Q_DISABLE_COPY(QBarSet) | 
| 108 |     friend class QAbstractBarSeries; | 
| 109 |     friend class BarLegendMarker; | 
| 110 |     friend class AbstractBarChartItem; | 
| 111 |     friend class QAbstractBarSeriesPrivate; | 
| 112 |     friend class StackedBarChartItem; | 
| 113 |     friend class PercentBarChartItem; | 
| 114 |     friend class BarChartItem; | 
| 115 |     friend class HorizontalBarChartItem; | 
| 116 |     friend class HorizontalStackedBarChartItem; | 
| 117 |     friend class HorizontalPercentBarChartItem; | 
| 118 |     friend class BoxPlotChartItem; | 
| 119 | }; | 
| 120 |  | 
| 121 | QT_END_NAMESPACE | 
| 122 |  | 
| 123 | #endif // QBARSET_H | 
| 124 |  |