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
11QT_BEGIN_NAMESPACE
12
13class QBarCategoryAxisPrivate;
14
15class 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
25public:
26 explicit QBarCategoryAxis(QObject *parent = nullptr);
27 ~QBarCategoryAxis() override;
28
29protected:
30 QBarCategoryAxis(QBarCategoryAxisPrivate &dd, QObject *parent = nullptr);
31
32public:
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
53Q_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
60private:
61 Q_DECLARE_PRIVATE(QBarCategoryAxis)
62 Q_DISABLE_COPY(QBarCategoryAxis)
63};
64
65QT_END_NAMESPACE
66
67#endif // QTGRAPHS_QBARCATEGORYAXIS_H
68

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtgraphs/src/graphs2d/axis/barcategoryaxis/qbarcategoryaxis.h