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