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 <QtQml/QJSValue> |
5 | #include <QtQml/QJSValueIterator> |
6 | |
7 | #include <Qt3DQuickRender/private/quick3dparameter_p_p.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | namespace Qt3DRender { |
12 | namespace Render { |
13 | namespace Quick { |
14 | |
15 | Quick3DParameterPrivate::Quick3DParameterPrivate() |
16 | : QParameterPrivate() |
17 | { |
18 | } |
19 | |
20 | void Quick3DParameterPrivate::setValue(const QVariant &value) |
21 | { |
22 | static const int qjsValueTypeId = qMetaTypeId<QJSValue>(); |
23 | |
24 | if (value.userType() == qjsValueTypeId) { |
25 | QJSValue v = value.value<QJSValue>(); |
26 | if (v.isArray()) |
27 | QParameterPrivate::setValue(value.value<QVariantList>()); |
28 | } else { |
29 | QParameterPrivate::setValue(value); |
30 | } |
31 | } |
32 | |
33 | Quick3DParameter::Quick3DParameter(QNode *parent) |
34 | : QParameter(*new Quick3DParameterPrivate, parent) |
35 | { |
36 | } |
37 | |
38 | /*! \internal */ |
39 | Quick3DParameter::Quick3DParameter(Quick3DParameterPrivate &dd, QNode *parent) |
40 | : QParameter(dd, parent) |
41 | { |
42 | } |
43 | |
44 | } // namespace Quick |
45 | } // namespace Render |
46 | } // namespace Qt3DRender |
47 | |
48 | QT_END_NAMESPACE |
49 | |
50 | #include "moc_quick3dparameter_p.cpp" |
51 | |
52 | |
53 |