1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef QITEMMODELSCATTERDATAPROXY_H
31#define QITEMMODELSCATTERDATAPROXY_H
32
33#include <QtDataVisualization/qscatterdataproxy.h>
34#include <QtCore/QAbstractItemModel>
35#include <QtCore/QString>
36#include <QtCore/QRegExp>
37
38QT_BEGIN_NAMESPACE_DATAVISUALIZATION
39
40class QItemModelScatterDataProxyPrivate;
41
42class QT_DATAVISUALIZATION_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy
43{
44 Q_OBJECT
45 Q_PROPERTY(QAbstractItemModel* itemModel READ itemModel WRITE setItemModel NOTIFY itemModelChanged)
46 Q_PROPERTY(QString xPosRole READ xPosRole WRITE setXPosRole NOTIFY xPosRoleChanged)
47 Q_PROPERTY(QString yPosRole READ yPosRole WRITE setYPosRole NOTIFY yPosRoleChanged)
48 Q_PROPERTY(QString zPosRole READ zPosRole WRITE setZPosRole NOTIFY zPosRoleChanged)
49 Q_PROPERTY(QString rotationRole READ rotationRole WRITE setRotationRole NOTIFY rotationRoleChanged)
50 Q_PROPERTY(QRegExp xPosRolePattern READ xPosRolePattern WRITE setXPosRolePattern NOTIFY xPosRolePatternChanged REVISION 1)
51 Q_PROPERTY(QRegExp yPosRolePattern READ yPosRolePattern WRITE setYPosRolePattern NOTIFY yPosRolePatternChanged REVISION 1)
52 Q_PROPERTY(QRegExp zPosRolePattern READ zPosRolePattern WRITE setZPosRolePattern NOTIFY zPosRolePatternChanged REVISION 1)
53 Q_PROPERTY(QRegExp rotationRolePattern READ rotationRolePattern WRITE setRotationRolePattern NOTIFY rotationRolePatternChanged REVISION 1)
54 Q_PROPERTY(QString xPosRoleReplace READ xPosRoleReplace WRITE setXPosRoleReplace NOTIFY xPosRoleReplaceChanged REVISION 1)
55 Q_PROPERTY(QString yPosRoleReplace READ yPosRoleReplace WRITE setYPosRoleReplace NOTIFY yPosRoleReplaceChanged REVISION 1)
56 Q_PROPERTY(QString zPosRoleReplace READ zPosRoleReplace WRITE setZPosRoleReplace NOTIFY zPosRoleReplaceChanged REVISION 1)
57 Q_PROPERTY(QString rotationRoleReplace READ rotationRoleReplace WRITE setRotationRoleReplace NOTIFY rotationRoleReplaceChanged REVISION 1)
58
59public:
60 explicit QItemModelScatterDataProxy(QObject *parent = nullptr);
61 explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = nullptr);
62 explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel,
63 const QString &xPosRole, const QString &yPosRole,
64 const QString &zPosRole, QObject *parent = nullptr);
65 explicit QItemModelScatterDataProxy(QAbstractItemModel *itemModel,
66 const QString &xPosRole, const QString &yPosRole,
67 const QString &zPosRole, const QString &rotationRole,
68 QObject *parent = nullptr);
69 virtual ~QItemModelScatterDataProxy();
70
71 void setItemModel(QAbstractItemModel *itemModel);
72 QAbstractItemModel *itemModel() const;
73
74 void setXPosRole(const QString &role);
75 QString xPosRole() const;
76 void setYPosRole(const QString &role);
77 QString yPosRole() const;
78 void setZPosRole(const QString &role);
79 QString zPosRole() const;
80 void setRotationRole(const QString &role);
81 QString rotationRole() const;
82
83 void remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole,
84 const QString &rotationRole);
85
86 void setXPosRolePattern(const QRegExp &pattern);
87 QRegExp xPosRolePattern() const;
88 void setYPosRolePattern(const QRegExp &pattern);
89 QRegExp yPosRolePattern() const;
90 void setZPosRolePattern(const QRegExp &pattern);
91 QRegExp zPosRolePattern() const;
92 void setRotationRolePattern(const QRegExp &pattern);
93 QRegExp rotationRolePattern() const;
94
95 void setXPosRoleReplace(const QString &replace);
96 QString xPosRoleReplace() const;
97 void setYPosRoleReplace(const QString &replace);
98 QString yPosRoleReplace() const;
99 void setZPosRoleReplace(const QString &replace);
100 QString zPosRoleReplace() const;
101 void setRotationRoleReplace(const QString &replace);
102 QString rotationRoleReplace() const;
103
104Q_SIGNALS:
105 void itemModelChanged(const QAbstractItemModel* itemModel);
106 void xPosRoleChanged(const QString &role);
107 void yPosRoleChanged(const QString &role);
108 void zPosRoleChanged(const QString &role);
109 void rotationRoleChanged(const QString &role);
110 Q_REVISION(1) void xPosRolePatternChanged(const QRegExp &pattern);
111 Q_REVISION(1) void yPosRolePatternChanged(const QRegExp &pattern);
112 Q_REVISION(1) void zPosRolePatternChanged(const QRegExp &pattern);
113 Q_REVISION(1) void rotationRolePatternChanged(const QRegExp &pattern);
114 Q_REVISION(1) void rotationRoleReplaceChanged(const QString &replace);
115 Q_REVISION(1) void xPosRoleReplaceChanged(const QString &replace);
116 Q_REVISION(1) void yPosRoleReplaceChanged(const QString &replace);
117 Q_REVISION(1) void zPosRoleReplaceChanged(const QString &replace);
118
119protected:
120 QItemModelScatterDataProxyPrivate *dptr();
121 const QItemModelScatterDataProxyPrivate *dptrc() const;
122
123private:
124 Q_DISABLE_COPY(QItemModelScatterDataProxy)
125
126 friend class ScatterItemModelHandler;
127};
128
129QT_END_NAMESPACE_DATAVISUALIZATION
130
131#endif
132

source code of qtdatavis3d/src/datavisualization/data/qitemmodelscatterdataproxy.h