| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTDATAVIS3D_QITEMMODELSCATTERDATAPROXY_H |
| 5 | #define QTDATAVIS3D_QITEMMODELSCATTERDATAPROXY_H |
| 6 | |
| 7 | #include <QtDataVisualization/qscatterdataproxy.h> |
| 8 | #include <QtCore/QAbstractItemModel> |
| 9 | #include <QtCore/QString> |
| 10 | #include <QtCore/QRegularExpression> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QItemModelScatterDataProxyPrivate; |
| 15 | |
| 16 | class Q_DATAVISUALIZATION_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | Q_PROPERTY(QAbstractItemModel* itemModel READ itemModel WRITE setItemModel NOTIFY itemModelChanged) |
| 20 | Q_PROPERTY(QString xPosRole READ xPosRole WRITE setXPosRole NOTIFY xPosRoleChanged) |
| 21 | Q_PROPERTY(QString yPosRole READ yPosRole WRITE setYPosRole NOTIFY yPosRoleChanged) |
| 22 | Q_PROPERTY(QString zPosRole READ zPosRole WRITE setZPosRole NOTIFY zPosRoleChanged) |
| 23 | Q_PROPERTY(QString rotationRole READ rotationRole WRITE setRotationRole NOTIFY rotationRoleChanged) |
| 24 | Q_PROPERTY(QRegularExpression xPosRolePattern READ xPosRolePattern WRITE setXPosRolePattern NOTIFY xPosRolePatternChanged REVISION(1, 1)) |
| 25 | Q_PROPERTY(QRegularExpression yPosRolePattern READ yPosRolePattern WRITE setYPosRolePattern NOTIFY yPosRolePatternChanged REVISION(1, 1)) |
| 26 | Q_PROPERTY(QRegularExpression zPosRolePattern READ zPosRolePattern WRITE setZPosRolePattern NOTIFY zPosRolePatternChanged REVISION(1, 1)) |
| 27 | Q_PROPERTY(QRegularExpression rotationRolePattern READ rotationRolePattern WRITE setRotationRolePattern NOTIFY rotationRolePatternChanged REVISION(1, 1)) |
| 28 | Q_PROPERTY(QString xPosRoleReplace READ xPosRoleReplace WRITE setXPosRoleReplace NOTIFY xPosRoleReplaceChanged REVISION(1, 1)) |
| 29 | Q_PROPERTY(QString yPosRoleReplace READ yPosRoleReplace WRITE setYPosRoleReplace NOTIFY yPosRoleReplaceChanged REVISION(1, 1)) |
| 30 | Q_PROPERTY(QString zPosRoleReplace READ zPosRoleReplace WRITE setZPosRoleReplace NOTIFY zPosRoleReplaceChanged REVISION(1, 1)) |
| 31 | Q_PROPERTY(QString rotationRoleReplace READ rotationRoleReplace WRITE setRotationRoleReplace NOTIFY rotationRoleReplaceChanged REVISION(1, 1)) |
| 32 | |
| 33 | public: |
| 34 | explicit QItemModelScatterDataProxy(QObject *parent = nullptr); |
| 35 | explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = nullptr); |
| 36 | explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel, |
| 37 | const QString &xPosRole, const QString &yPosRole, |
| 38 | const QString &zPosRole, QObject *parent = nullptr); |
| 39 | explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel, |
| 40 | const QString &xPosRole, const QString &yPosRole, |
| 41 | const QString &zPosRole, const QString &rotationRole, |
| 42 | QObject *parent = nullptr); |
| 43 | virtual ~QItemModelScatterDataProxy(); |
| 44 | |
| 45 | void setItemModel(QAbstractItemModel *itemModel); |
| 46 | QAbstractItemModel *itemModel() const; |
| 47 | |
| 48 | void setXPosRole(const QString &role); |
| 49 | QString xPosRole() const; |
| 50 | void setYPosRole(const QString &role); |
| 51 | QString yPosRole() const; |
| 52 | void setZPosRole(const QString &role); |
| 53 | QString zPosRole() const; |
| 54 | void setRotationRole(const QString &role); |
| 55 | QString rotationRole() const; |
| 56 | |
| 57 | void remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, |
| 58 | const QString &rotationRole); |
| 59 | |
| 60 | void setXPosRolePattern(const QRegularExpression &pattern); |
| 61 | QRegularExpression xPosRolePattern() const; |
| 62 | void setYPosRolePattern(const QRegularExpression &pattern); |
| 63 | QRegularExpression yPosRolePattern() const; |
| 64 | void setZPosRolePattern(const QRegularExpression &pattern); |
| 65 | QRegularExpression zPosRolePattern() const; |
| 66 | void setRotationRolePattern(const QRegularExpression &pattern); |
| 67 | QRegularExpression rotationRolePattern() const; |
| 68 | |
| 69 | void setXPosRoleReplace(const QString &replace); |
| 70 | QString xPosRoleReplace() const; |
| 71 | void setYPosRoleReplace(const QString &replace); |
| 72 | QString yPosRoleReplace() const; |
| 73 | void setZPosRoleReplace(const QString &replace); |
| 74 | QString zPosRoleReplace() const; |
| 75 | void setRotationRoleReplace(const QString &replace); |
| 76 | QString rotationRoleReplace() const; |
| 77 | |
| 78 | Q_SIGNALS: |
| 79 | void itemModelChanged(const QAbstractItemModel* itemModel); |
| 80 | void xPosRoleChanged(const QString &role); |
| 81 | void yPosRoleChanged(const QString &role); |
| 82 | void zPosRoleChanged(const QString &role); |
| 83 | void rotationRoleChanged(const QString &role); |
| 84 | Q_REVISION(1, 1) void xPosRolePatternChanged(const QRegularExpression &pattern); |
| 85 | Q_REVISION(1, 1) void yPosRolePatternChanged(const QRegularExpression &pattern); |
| 86 | Q_REVISION(1, 1) void zPosRolePatternChanged(const QRegularExpression &pattern); |
| 87 | Q_REVISION(1, 1) void rotationRolePatternChanged(const QRegularExpression &pattern); |
| 88 | Q_REVISION(1, 1) void rotationRoleReplaceChanged(const QString &replace); |
| 89 | Q_REVISION(1, 1) void xPosRoleReplaceChanged(const QString &replace); |
| 90 | Q_REVISION(1, 1) void yPosRoleReplaceChanged(const QString &replace); |
| 91 | Q_REVISION(1, 1) void zPosRoleReplaceChanged(const QString &replace); |
| 92 | |
| 93 | protected: |
| 94 | QItemModelScatterDataProxyPrivate *dptr(); |
| 95 | const QItemModelScatterDataProxyPrivate *dptrc() const; |
| 96 | |
| 97 | private: |
| 98 | Q_DISABLE_COPY(QItemModelScatterDataProxy) |
| 99 | |
| 100 | friend class ScatterItemModelHandler; |
| 101 | }; |
| 102 | |
| 103 | QT_END_NAMESPACE |
| 104 | |
| 105 | #endif |
| 106 | |