1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
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 <Qt3DQuickRender/private/quick3drenderpassfilter_p.h>
5
6QT_BEGIN_NAMESPACE
7
8namespace Qt3DRender {
9namespace Render {
10namespace Quick {
11
12Quick3DRenderPassFilter::Quick3DRenderPassFilter(QObject *parent)
13 : QObject(parent)
14{
15}
16
17QQmlListProperty<QFilterKey> Quick3DRenderPassFilter::includeList()
18{
19 using qt_size_type = qsizetype;
20
21 auto appendFunction = [](QQmlListProperty<QFilterKey> *list, QFilterKey *v) {
22 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
23 if (self) {
24 v->setParent(self->parentRenderPassFilter());
25 self->parentRenderPassFilter()->addMatch(filterKey: v);
26 }
27 };
28 auto countFunction = [](QQmlListProperty<QFilterKey> *list) -> qt_size_type {
29 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
30 if (self)
31 return self->parentRenderPassFilter()->matchAny().size();
32 return 0;
33 };
34 auto atFunction = [](QQmlListProperty<QFilterKey> *list, qt_size_type index) -> QFilterKey * {
35 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
36 if (self)
37 return self->parentRenderPassFilter()->matchAny().at(i: index);
38 return nullptr;
39 };
40 auto clearFunction = [](QQmlListProperty<QFilterKey> *list) {
41 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
42 if (self) {
43 const auto l = self->parentRenderPassFilter()->matchAny();
44 for (auto *v : l)
45 self->parentRenderPassFilter()->removeMatch(filterKey: v);
46 }
47 };
48
49 return QQmlListProperty<QFilterKey>(this, nullptr, appendFunction, countFunction, atFunction, clearFunction);
50}
51
52QQmlListProperty<QParameter> Quick3DRenderPassFilter::parameterList()
53{
54 using qt_size_type = qsizetype;
55
56 auto appendFunction = [](QQmlListProperty<QParameter> *list, QParameter *v) {
57 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
58 if (self) {
59 self->parentRenderPassFilter()->addParameter(parameter: v);
60 }
61 };
62 auto countFunction = [](QQmlListProperty<QParameter> *list) -> qt_size_type {
63 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
64 if (self)
65 return self->parentRenderPassFilter()->parameters().size();
66 return 0;
67 };
68 auto atFunction = [](QQmlListProperty<QParameter> *list, qt_size_type index) -> QParameter * {
69 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
70 if (self)
71 return self->parentRenderPassFilter()->parameters().at(i: index);
72 return nullptr;
73 };
74 auto clearFunction = [](QQmlListProperty<QParameter> *list) {
75 auto self = qobject_cast<Quick3DRenderPassFilter *>(object: list->object);
76 if (self) {
77 const auto l = self->parentRenderPassFilter()->parameters();
78 for (auto *v : l)
79 self->parentRenderPassFilter()->removeParameter(parameter: v);
80 }
81 };
82
83 return QQmlListProperty<QParameter>(this, nullptr, appendFunction, countFunction, atFunction, clearFunction);
84}
85
86} // namespace Quick
87} // namespace Render
88} // namespace Qt3DRender
89
90QT_END_NAMESPACE
91
92#include "moc_quick3drenderpassfilter_p.cpp"
93

source code of qt3d/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp