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

source code of qtopcua/src/declarative_opcua/opcuarelativenodeid_p.h