1// Copyright (C) 2019 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 OPCUASIMPLEATTRIBUTEOPERAND_P_H
5#define OPCUASIMPLEATTRIBUTEOPERAND_P_H
6
7#include <private/opcuaoperandbase_p.h>
8
9#include <QOpcUaSimpleAttributeOperand>
10#include <QQmlListProperty>
11#include <QList>
12#include <QtQml/qqml.h>
13
14//
15// W A R N I N G
16// -------------
17//
18// This file is not part of the Qt API. It exists purely as an
19// implementation detail. This header file may change from version to
20// version without notice, or even be removed.
21//
22// We mean it.
23//
24
25QT_BEGIN_NAMESPACE
26
27class OpcUaNodeId;
28class QOpcUaClient;
29
30class OpcUaSimpleAttributeOperand : public OpcUaOperandBase, private QOpcUaSimpleAttributeOperand {
31 Q_OBJECT
32 Q_PROPERTY(QQmlListProperty<OpcUaNodeId> browsePath READ browsePath)
33 Q_PROPERTY(QString indexRange READ indexRange WRITE setIndexRange)
34 Q_PROPERTY(QOpcUa::NodeAttribute nodeAttribute READ nodeAttribute WRITE setNodeAttribute)
35 Q_PROPERTY(QString typeId READ typeId WRITE setTypeId)
36
37 QML_NAMED_ELEMENT(SimpleAttributeOperand)
38 QML_ADDED_IN_VERSION(5, 13)
39
40public:
41 explicit OpcUaSimpleAttributeOperand(QObject *parent = nullptr);
42 ~OpcUaSimpleAttributeOperand();
43 QOpcUaSimpleAttributeOperand toSimpleAttributeOperand(QOpcUaClient *client) const;
44 virtual QVariant toCppVariant(QOpcUaClient *client) const override;
45
46 QString indexRange() const;
47 void setIndexRange(const QString &indexRange);
48
49 QOpcUa::NodeAttribute nodeAttribute() const;
50 void setNodeAttribute(QOpcUa::NodeAttribute nodeAttribute);
51
52 QString typeId() const;
53 void setTypeId(const QString &typeId);
54
55 QQmlListProperty<OpcUaNodeId> browsePath();
56 void appendBrowsePathElement(OpcUaNodeId*nodeId);
57 int browsePathSize() const;
58 OpcUaNodeId *browsePathElement(int index) const;
59 void clearBrowsePath();
60
61signals:
62 void dataChanged();
63
64private:
65 static void appendBrowsePathElement(QQmlListProperty<OpcUaNodeId> *list, OpcUaNodeId *nodeId);
66 static qsizetype browsePathSize(QQmlListProperty<OpcUaNodeId> *list);
67 static OpcUaNodeId* browsePathElement(QQmlListProperty<OpcUaNodeId> *list, qsizetype index);
68 static void clearBrowsePath(QQmlListProperty<OpcUaNodeId> *list);
69
70 QList<OpcUaNodeId*> m_browsePath;
71};
72
73QT_END_NAMESPACE
74
75#endif // OPCUASIMPLEATTRIBUTEOPERAND_P_H
76

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