| 1 | // Copyright (C) 2016 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 | |
| 4 | #ifndef QBARCATEGORYAXIS_H | 
| 5 | #define QBARCATEGORYAXIS_H | 
| 6 | |
| 7 | #include <QtCharts/QAbstractAxis> | 
| 8 | |
| 9 | QT_BEGIN_NAMESPACE | 
| 10 | |
| 11 | class QBarCategoryAxisPrivate; | 
| 12 | |
| 13 | class Q_CHARTS_EXPORT QBarCategoryAxis : public QAbstractAxis | 
| 14 | { | 
| 15 | Q_OBJECT | 
| 16 | Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged) | 
| 17 | Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged) | 
| 18 | Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged) | 
| 19 | Q_PROPERTY(int count READ count NOTIFY countChanged) | 
| 20 | |
| 21 | public: | 
| 22 | explicit QBarCategoryAxis(QObject *parent = nullptr); | 
| 23 | ~QBarCategoryAxis(); | 
| 24 | |
| 25 | protected: | 
| 26 | QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent = nullptr); | 
| 27 | |
| 28 | public: | 
| 29 | AxisType type() const override; | 
| 30 | void append(const QStringList &categories); | 
| 31 | void append(const QString &category); | 
| 32 | void remove(const QString &category); | 
| 33 | void insert(int index, const QString &category); | 
| 34 | void replace(const QString &oldCategory, const QString &newCategory); | 
| 35 | Q_INVOKABLE void clear(); | 
| 36 | void setCategories(const QStringList &categories); | 
| 37 | QStringList categories(); | 
| 38 | int count() const; | 
| 39 | QString at(int index) const; | 
| 40 | |
| 41 | //range handling | 
| 42 | void setMin(const QString &minCategory); | 
| 43 | QString min() const; | 
| 44 | void setMax(const QString &maxCategory); | 
| 45 | QString max() const; | 
| 46 | void setRange(const QString &minCategory, const QString &maxCategory); | 
| 47 | |
| 48 | Q_SIGNALS: | 
| 49 | void categoriesChanged(); | 
| 50 | void minChanged(const QString &min); | 
| 51 | void maxChanged(const QString &max); | 
| 52 | void rangeChanged(const QString &min, const QString &max); | 
| 53 | void countChanged(); | 
| 54 | |
| 55 | private: | 
| 56 | Q_DECLARE_PRIVATE(QBarCategoryAxis) | 
| 57 | Q_DISABLE_COPY(QBarCategoryAxis) | 
| 58 | friend class ChartBarCategoryAxisX; | 
| 59 | friend class ChartBarCategoryAxisY; | 
| 60 | }; | 
| 61 | |
| 62 | QT_END_NAMESPACE | 
| 63 | |
| 64 | #endif // QBARCATEGORYAXIS_H | 
| 65 | 
