summaryrefslogtreecommitdiffstats
path: root/src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire.ecortex@kdab.com>2014-12-04 11:54:55 +0100
committerSean Harmer <sean.harmer@kdab.com>2014-12-12 14:17:39 +0100
commit87401507ec111dc1b6bf252a8662d90d5caae523 (patch)
tree425b1a632b798e68d6cb1a95119cde7914a3dcc0 /src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h
parent634285f5e0c2555bd108f5f8ed979a0a18505429 (diff)
Quick3DShaderDataArray
QML allows property var array: [] of simple types only. We can't use a var property to store an array of ShaderDataObject so Quick3DShaderDataArray was introduce to overcome that issue. It contains a QQmlListProperty<Quick3DShaderData>. This is only needed for QML, in C++ providing a QVariantList of QShaderData is enough. Change-Id: I768f5189252c219c5a1718b4c4da128bbaff008e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h')
-rw-r--r--src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h b/src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h
new file mode 100644
index 000000000..710d16519
--- /dev/null
+++ b/src/quick3d/quick3drenderer/items/quick3dshaderdataarray.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3D_RENDER_QUICK_QUICK3DSHADERDATAARRAY_H
+#define QT3D_RENDER_QUICK_QUICK3DSHADERDATAARRAY_H
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DQuickRenderer/qt3dquickrenderer_global.h>
+#include <Qt3DQuickRenderer/quick3dshaderdata.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace Render {
+
+namespace Quick {
+
+class Quick3DShaderDataArrayPrivate;
+class Quick3DShaderData;
+
+class QT3DQUICKRENDERERSHARED_EXPORT Quick3DShaderDataArray : public QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3D::Render::Quick::Quick3DShaderData> values READ valuesList)
+ Q_CLASSINFO("DefaultProperty", "values")
+public:
+ explicit Quick3DShaderDataArray(QNode *parent = 0);
+ QQmlListProperty<Quick3DShaderData> valuesList();
+ QList<Quick3DShaderData *> values() const;
+
+protected:
+ void copy(const QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ static void appendValue(QQmlListProperty<Quick3DShaderData> *list, Quick3DShaderData *bar);
+ static Quick3DShaderData *valueAt(QQmlListProperty<Quick3DShaderData> *list, int index);
+ static int valueCount(QQmlListProperty<Quick3DShaderData> *list);
+ static void clearValues(QQmlListProperty<Quick3DShaderData> *list);
+ Q_DECLARE_PRIVATE(Quick3DShaderDataArray)
+ QT3D_CLONEABLE(Quick3DShaderDataArray)
+};
+
+} // Quick
+
+} // Render
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3D::Render::Quick::Quick3DShaderDataArray *)
+
+#endif // QT3D_RENDER_QUICK_QUICK3DSHADERDATAARRAY_H