| 1 | // Copyright (C) 2023 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTGRAPHS_QBAR3DSERIES_H |
| 5 | #define QTGRAPHS_QBAR3DSERIES_H |
| 6 | |
| 7 | #include <QtCore/qpoint.h> |
| 8 | #include <QtGraphs/qabstract3dseries.h> |
| 9 | #include <QtGraphs/qbardataproxy.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class QBar3DSeriesPrivate; |
| 14 | class QQuaternion; |
| 15 | |
| 16 | class Q_GRAPHS_EXPORT QBar3DSeries : public QAbstract3DSeries |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | Q_DECLARE_PRIVATE(QBar3DSeries) |
| 20 | Q_PROPERTY( |
| 21 | QBarDataProxy *dataProxy READ dataProxy WRITE setDataProxy NOTIFY dataProxyChanged FINAL) |
| 22 | Q_PROPERTY(QPoint selectedBar READ selectedBar WRITE setSelectedBar NOTIFY selectedBarChanged) |
| 23 | Q_PROPERTY(float meshAngle READ meshAngle WRITE setMeshAngle NOTIFY meshAngleChanged FINAL) |
| 24 | Q_PROPERTY(QList<QColor> rowColors READ rowColors WRITE setRowColors NOTIFY rowColorsChanged) |
| 25 | Q_PROPERTY(QStringList rowLabels READ rowLabels WRITE setRowLabels NOTIFY rowLabelsChanged FINAL) |
| 26 | Q_PROPERTY(QStringList columnLabels READ columnLabels WRITE setColumnLabels NOTIFY |
| 27 | columnLabelsChanged FINAL) |
| 28 | Q_PROPERTY( |
| 29 | QBarDataArray dataArray READ dataArray WRITE setDataArray NOTIFY dataArrayChanged FINAL) |
| 30 | Q_PROPERTY(bool valueColoringEnabled READ isValueColoringEnabled WRITE setValueColoringEnabled |
| 31 | NOTIFY valueColoringEnabledChanged REVISION(6, 9)) |
| 32 | QML_ELEMENT |
| 33 | QML_UNCREATABLE("Trying to create uncreatable: QBar3DSeries, use Bar3DSeries instead." ) |
| 34 | public: |
| 35 | explicit QBar3DSeries(QObject *parent = nullptr); |
| 36 | explicit QBar3DSeries(QBarDataProxy *dataProxy, QObject *parent = nullptr); |
| 37 | ~QBar3DSeries() override; |
| 38 | |
| 39 | void setDataProxy(QBarDataProxy *proxy); |
| 40 | QBarDataProxy *dataProxy() const; |
| 41 | |
| 42 | void setSelectedBar(QPoint position); |
| 43 | QPoint selectedBar() const; |
| 44 | static QPoint invalidSelectionPosition(); |
| 45 | |
| 46 | void setMeshAngle(float angle); |
| 47 | float meshAngle() const; |
| 48 | |
| 49 | QList<QColor> rowColors() const; |
| 50 | void setRowColors(const QList<QColor> &colors); |
| 51 | |
| 52 | bool isValueColoringEnabled() const; |
| 53 | void setValueColoringEnabled(bool enabled); |
| 54 | |
| 55 | void setDataArray(const QBarDataArray &newDataArray); |
| 56 | void clearRow(qsizetype rowIndex); |
| 57 | void clearArray(); |
| 58 | const QBarDataArray &dataArray() const &; |
| 59 | QBarDataArray dataArray() &&; |
| 60 | QStringList rowLabels() const; |
| 61 | void setRowLabels(const QStringList &labels); |
| 62 | QStringList columnLabels() const; |
| 63 | void setColumnLabels(const QStringList &labels); |
| 64 | |
| 65 | Q_SIGNALS: |
| 66 | void dataProxyChanged(QBarDataProxy *proxy); |
| 67 | void selectedBarChanged(QPoint position); |
| 68 | void meshAngleChanged(float angle); |
| 69 | void rowColorsChanged(const QList<QColor> &rowcolors); |
| 70 | void rowLabelsChanged(); |
| 71 | void columnLabelsChanged(); |
| 72 | void dataArrayChanged(const QBarDataArray &array); |
| 73 | Q_REVISION(6, 9) void valueColoringEnabledChanged(bool enabled); |
| 74 | |
| 75 | private: |
| 76 | Q_DISABLE_COPY(QBar3DSeries) |
| 77 | |
| 78 | void connectSignals(); |
| 79 | void handleMeshRotationChanged(const QQuaternion &rotation); |
| 80 | |
| 81 | friend class QQuickGraphsBars; |
| 82 | }; |
| 83 | |
| 84 | QT_END_NAMESPACE |
| 85 | |
| 86 | #endif |
| 87 | |