diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-11-11 11:09:48 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-11-11 22:12:38 +0000 |
commit | df4a57731ba9cc5aa56d29de0cd7701b07672c31 (patch) | |
tree | b8a30814cb5fc3d4647e0e3bdc456a7db30c17d9 /src/quick | |
parent | ded64d03686268b9ead0f0b5c9299683859a1160 (diff) |
Introduce a more sane "default constructor" for Qt.matrix4x4()
If no arguments are specified, create an identity matrix. This is by
far the most common use case. This change avoids having to type in the
16 arguments of the identity matrix.
Change-Id: I9e0d71897c5368d19ae87cff936df4b9e5e9b84a
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 25dd09c01f..2ea1a062d8 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -466,7 +466,11 @@ public: } break; case QMetaType::QMatrix4x4: - if (argc == 1) { + if (argc == 0) { + QMatrix4x4 m; + *v = QVariant(m); + return true; + } else if (argc == 1) { const qreal *vals = reinterpret_cast<const qreal*>(argv[0]); QMatrix4x4 m(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], |