summaryrefslogtreecommitdiffstats
path: root/src/core/transforms
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-07-04 12:13:05 +0200
committerPaul Lemire <paul.lemire@kdab.com>2014-07-06 10:24:36 +0200
commitac7eda8d1b08c6e6228458fb89c88a5f4f15a301 (patch)
treea53f8f7a5288327c1749b36db531758784f99a0e /src/core/transforms
parentf6527d4f100008438f5714f861c40fce4037ac54 (diff)
QMatrixTransform d-pointered and completed
Change-Id: I1509ded22f7f6d5988e5795e53b6bb77dafd842f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/transforms')
-rw-r--r--src/core/transforms/qmatrixtransform.cpp33
-rw-r--r--src/core/transforms/qmatrixtransform.h21
-rw-r--r--src/core/transforms/qmatrixtransform_p.h66
-rw-r--r--src/core/transforms/transforms.pri3
4 files changed, 112 insertions, 11 deletions
diff --git a/src/core/transforms/qmatrixtransform.cpp b/src/core/transforms/qmatrixtransform.cpp
index 719ab0074..fbe110756 100644
--- a/src/core/transforms/qmatrixtransform.cpp
+++ b/src/core/transforms/qmatrixtransform.cpp
@@ -40,23 +40,48 @@
****************************************************************************/
#include "qmatrixtransform.h"
+#include "qmatrixtransform_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3D {
-QMatrixTransform::QMatrixTransform()
+QMatrixTransformPrivate::QMatrixTransformPrivate(QMatrixTransform *qq)
+ : QAbstractTransformPrivate(qq)
{
}
-QMatrixTransform::QMatrixTransform(const QMatrix4x4& m) :
- m_matrix(m)
+QMatrixTransform::QMatrixTransform(QMatrixTransformPrivate &dd, QNode *parent)
+ : QAbstractTransform(dd, parent)
{
}
+QMatrixTransform::QMatrixTransform(QNode *parent)
+ : QAbstractTransform(*new QMatrixTransformPrivate(this), parent)
+{
+}
+
+QMatrixTransform::QMatrixTransform(const QMatrix4x4& m, QNode *parent)
+ : QAbstractTransform(*new QMatrixTransformPrivate(this), parent)
+{
+ Q_D(QMatrixTransform);
+ d->m_matrix = m;
+}
+
QMatrix4x4 QMatrixTransform::matrix() const
{
- return m_matrix;
+ Q_D(const QMatrixTransform);
+ return d->m_matrix;
+}
+
+void QMatrixTransform::setMatrix(const QMatrix4x4 &matrix)
+{
+ Q_D(QMatrixTransform);
+ if (d->m_matrix != matrix) {
+ d->m_matrix = matrix;
+ emit matrixChanged();
+ emit transformUpdated();
+ }
}
} // namespace Qt3D
diff --git a/src/core/transforms/qmatrixtransform.h b/src/core/transforms/qmatrixtransform.h
index 4ae88e17e..78cca7aae 100644
--- a/src/core/transforms/qmatrixtransform.h
+++ b/src/core/transforms/qmatrixtransform.h
@@ -51,16 +51,25 @@ QT_BEGIN_NAMESPACE
namespace Qt3D {
-class QT3DCORESHARED_EXPORT QMatrixTransform : public QAbstractTransform
+class QMatrixTransformPrivate;
+
+class QT3DCORESHARED_EXPORT QMatrixTransform : public Qt3D::QAbstractTransform
{
+ Q_OBJECT
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged)
public:
- QMatrixTransform();
+ explicit QMatrixTransform(QNode *parent = 0);
+ QMatrixTransform(const QMatrix4x4& m, QNode *parent = 0);
+
+ QMatrix4x4 matrix() const Q_DECL_OVERRIDE;
+ void setMatrix(const QMatrix4x4 &matrix);
- QMatrixTransform( const QMatrix4x4& m );
+Q_SIGNALS:
+ void matrixChanged();
- virtual QMatrix4x4 matrix() const;
-private:
- QMatrix4x4 m_matrix;
+protected:
+ Q_DECLARE_PRIVATE(QMatrixTransform)
+ QMatrixTransform(QMatrixTransformPrivate &dd, QNode *parent = 0);
};
} // namespace Qt3D
diff --git a/src/core/transforms/qmatrixtransform_p.h b/src/core/transforms/qmatrixtransform_p.h
new file mode 100644
index 000000000..7be1e972a
--- /dev/null
+++ b/src/core/transforms/qmatrixtransform_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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_QMATRIXTRANSFORM_P_H
+#define QT3D_QMATRIXTRANSFORM_P_H
+
+#include <private/qabstracttransform_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+class QMatrixTransform;
+
+class QMatrixTransformPrivate : public QAbstractTransformPrivate
+{
+public:
+ QMatrixTransformPrivate(QMatrixTransform *qq);
+
+ Q_DECLARE_PUBLIC(QMatrixTransform)
+ QMatrix4x4 m_matrix;
+};
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3D_QMATRIXTRANSFORM_P_H
diff --git a/src/core/transforms/transforms.pri b/src/core/transforms/transforms.pri
index afdd0dfef..c9fe52d85 100644
--- a/src/core/transforms/transforms.pri
+++ b/src/core/transforms/transforms.pri
@@ -18,6 +18,7 @@ HEADERS += \
$$PWD/qtransform.h \
$$PWD/qtransform_p.h \
$$PWD/qabstracttransform_p.h \
- $$PWD/qlookattransform_p.h
+ $$PWD/qlookattransform_p.h \
+ $$PWD/qmatrixtransform_p.h
INCLUDEPATH += $$PWD