1/****************************************************************************
2**
3** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qfilterkey.h"
41#include "qfilterkey_p.h"
42#include <private/qnode_p.h>
43#include <Qt3DCore/qpropertyupdatedchange.h>
44
45QT_BEGIN_NAMESPACE
46
47namespace Qt3DRender {
48
49
50QFilterKeyPrivate::QFilterKeyPrivate()
51 : QNodePrivate()
52{
53}
54
55/*!
56 \class Qt3DRender::QFilterKey
57 \inmodule Qt3DRender
58 \inherits Qt3DCore::QNode
59 \since 5.5
60 \brief The QFilterKey class provides storage for filter keys and their values.
61
62 Filter keys are used by QTechnique and QRenderPass to specify at which stage of rendering the
63 technique or the render pass is used.
64*/
65
66/*!
67 \qmltype FilterKey
68 \instantiates Qt3DRender::QFilterKey
69 \inherits Node
70 \inqmlmodule Qt3D.Render
71 \since 5.5
72 \brief Stores filter keys and their values.
73
74 A FilterKey is a storage type for filter key and value pair.
75 Filter keys are used by Technique and RenderPass to specify at which stage of rendering the
76 technique or the render pass is used.
77*/
78
79QFilterKey::QFilterKey(QNode *parent)
80 : QNode(*new QFilterKeyPrivate, parent)
81{
82}
83
84QFilterKey::~QFilterKey()
85{
86}
87
88void QFilterKey::setValue(const QVariant &value)
89{
90 Q_D(QFilterKey);
91 if (value != d->m_value) {
92 d->m_value = value;
93 emit valueChanged(value);
94 }
95}
96
97void QFilterKey::setName(const QString &name)
98{
99 Q_D(QFilterKey);
100 if (name != d->m_name) {
101 d->m_name = name;
102 emit nameChanged(name);
103 }
104}
105
106/*!
107 \property QFilterKey::value
108
109 Holds the value of the filter key.
110*/
111
112/*!
113 \qmlproperty variant FilterKey::value
114
115 Holds the value of the filter key.
116*/
117
118QVariant QFilterKey::value() const
119{
120 Q_D(const QFilterKey);
121 return d->m_value;
122}
123
124/*!
125 \property QFilterKey::name
126
127 Holds the name of the filter key.
128*/
129
130/*!
131 \qmlproperty string FilterKey::name
132
133 Holds the name of the filter key.
134*/
135
136QString QFilterKey::name() const
137{
138 Q_D(const QFilterKey);
139 return d->m_name;
140}
141
142Qt3DCore::QNodeCreatedChangeBasePtr QFilterKey::createNodeCreationChange() const
143{
144 auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QFilterKeyData>::create(this);
145 auto &data = creationChange->data;
146 Q_D(const QFilterKey);
147 data.name = d->m_name;
148 data.value = d->m_value;
149 return creationChange;
150}
151
152} // namespace Qt3DRender
153
154QT_END_NAMESPACE
155