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#include <private/opcualiteraloperand_p.h>
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 \qmltype LiteralOperand
10 \inqmlmodule QtOpcUa
11 \brief The OPC UA LiteralOperand type.
12 \since QtOpcUa 5.13
13 \deprecated [6.9]
14
15 The LiteralOperand is defined in OPC UA 1.05 part 4, 7.7.4.3.
16 It contains a literal value that is to be used as operand for filters.
17
18 Setting the type should be done to match the expected types on the server.
19 Otherwise the type will be guessed and may lead to errors because it does
20 not match on the server.
21
22 \code
23 import QtOpcUa as QtOpcUa
24
25 QtOpcUa.LiteralOperand {
26 value: 43.21
27 type: QtOpcUa.Constants.Double
28 }
29 \endcode
30*/
31
32/*!
33 \qmlproperty QOpcUa.Types LiteralOperand::type
34
35 Type of the value of the literal operand.
36*/
37
38/*!
39 \qmlproperty variant LiteralOperand::value
40
41 Value of the literal operand.
42*/
43
44OpcUaLiteralOperand::OpcUaLiteralOperand(QObject *parent)
45 : OpcUaOperandBase(parent)
46 , m_type(QOpcUa::Undefined)
47{
48}
49
50OpcUaLiteralOperand::~OpcUaLiteralOperand() = default;
51
52QVariant OpcUaLiteralOperand::toCppVariant(QOpcUaClient *client) const
53{
54 Q_UNUSED(client);
55 return QOpcUaLiteralOperand(m_value, m_type);
56}
57
58QVariant OpcUaLiteralOperand::value() const
59{
60 return m_value;
61}
62
63void OpcUaLiteralOperand::setValue(const QVariant &value)
64{
65 if (m_value != value) {
66 m_value = value;
67 emit dataChanged();
68 }
69}
70
71QOpcUa::Types OpcUaLiteralOperand::type() const
72{
73 return m_type;
74}
75
76void OpcUaLiteralOperand::setType(QOpcUa::Types type)
77{
78 if (m_type != type) {
79 m_type = type;
80 emit dataChanged();
81 }
82}
83
84QT_END_NAMESPACE
85

source code of qtopcua/src/declarative_opcua/opcualiteraloperand.cpp