1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtGraphs API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef SCATTERITEMMODELHANDLER_P_H
15#define SCATTERITEMMODELHANDLER_P_H
16
17#include "abstractitemmodelhandler_p.h"
18#include "qitemmodelscatterdataproxy_p.h"
19
20QT_BEGIN_NAMESPACE
21
22class ScatterItemModelHandler : public AbstractItemModelHandler
23{
24 Q_OBJECT
25public:
26 ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent = 0);
27 ~ScatterItemModelHandler() override;
28
29public Q_SLOTS:
30 void handleDataChanged(const QModelIndex &topLeft,
31 const QModelIndex &bottomRight,
32 const QList<int> &roles = QList<int>()) override;
33 void handleRowsInserted(const QModelIndex &parent, int start, int end) override;
34 void handleRowsRemoved(const QModelIndex &parent, int start, int end) override;
35
36protected:
37 void resolveModel() override;
38
39private:
40 void modelPosToScatterItem(int modelRow, int modelColumn, QScatterDataItem &item);
41 QVector3D modelDataToScale(int modelRow, int modelColumn);
42
43 QItemModelScatterDataProxy *m_proxy; // Not owned
44 QScatterDataArray m_proxyArray;
45 int m_xPosRole;
46 int m_yPosRole;
47 int m_zPosRole;
48 int m_rotationRole;
49 QList<QVector3D> m_scaleArray;
50 int m_scaleRole;
51 QRegularExpression m_xPosPattern;
52 QRegularExpression m_yPosPattern;
53 QRegularExpression m_zPosPattern;
54 QRegularExpression m_rotationPattern;
55 QRegularExpression m_scalePattern;
56 QString m_xPosReplace;
57 QString m_yPosReplace;
58 QString m_zPosReplace;
59 QString m_rotationReplace;
60 QString m_scaleReplace;
61 bool m_haveXPosPattern;
62 bool m_haveYPosPattern;
63 bool m_haveZPosPattern;
64 bool m_haveRotationPattern;
65 bool m_haveScalePattern;
66};
67
68QT_END_NAMESPACE
69
70#endif
71

source code of qtgraphs/src/graphs3d/data/scatteritemmodelhandler_p.h