1 | // Copyright (C) 2018 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QOPCUA_OPCUARELATIVENODEID_P_H |
5 | #define QOPCUA_OPCUARELATIVENODEID_P_H |
6 | |
7 | #include <private/opcuanodeidtype_p.h> |
8 | |
9 | #include <QList> |
10 | #include <QQmlListProperty> |
11 | #include <QtQml/qqml.h> |
12 | |
13 | // |
14 | // W A R N I N G |
15 | // ------------- |
16 | // |
17 | // This file is not part of the Qt API. It exists purely as an |
18 | // implementation detail. This header file may change from version to |
19 | // version without notice, or even be removed. |
20 | // |
21 | // We mean it. |
22 | // |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class OpcUaRelativeNodePath; |
27 | class OpcUaNodeIdType; |
28 | |
29 | class OpcUaRelativeNodeId : public OpcUaNodeIdType |
30 | { |
31 | Q_OBJECT |
32 | Q_DISABLE_COPY(OpcUaRelativeNodeId) |
33 | Q_PROPERTY(OpcUaNodeIdType* startNode READ startNode WRITE setStartNode NOTIFY startNodeChanged) |
34 | Q_PROPERTY(QQmlListProperty<OpcUaRelativeNodePath> path READ paths) |
35 | |
36 | QML_NAMED_ELEMENT(RelativeNodeId) |
37 | QML_ADDED_IN_VERSION(5, 12) |
38 | |
39 | public: |
40 | explicit OpcUaRelativeNodeId(QObject *parent = nullptr); |
41 | |
42 | OpcUaNodeIdType *startNode() const; |
43 | QQmlListProperty<OpcUaRelativeNodePath> paths(); |
44 | void appendPath(OpcUaRelativeNodePath *path); |
45 | int pathCount() const; |
46 | OpcUaRelativeNodePath *path(int) const; |
47 | void clearPaths(); |
48 | |
49 | signals: |
50 | void startNodeChanged(OpcUaNodeIdType *startNode); |
51 | void pathChanged(); |
52 | |
53 | public slots: |
54 | void setStartNode(OpcUaNodeIdType *startNode); |
55 | |
56 | private: |
57 | static void appendPath(QQmlListProperty<OpcUaRelativeNodePath>*, OpcUaRelativeNodePath *); |
58 | static qsizetype pathCount(QQmlListProperty<OpcUaRelativeNodePath>*); |
59 | static OpcUaRelativeNodePath* path(QQmlListProperty<OpcUaRelativeNodePath>*, qsizetype); |
60 | static void clearPaths(QQmlListProperty<OpcUaRelativeNodePath>*); |
61 | |
62 | OpcUaNodeIdType *m_startNode = nullptr; |
63 | QList<OpcUaRelativeNodePath *> m_paths; |
64 | |
65 | }; |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | #endif // QOPCUA_OPCUARELATIVENODEID_P_H |
70 |