summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qvector2d.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-08-21 04:43:15 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-08-21 04:43:15 (GMT)
commitbc9ced591a81293a155800cb28771f3bac17a9d2 (patch)
treed616a685f1de2ccb045a6d275a07d6fd8b2fb732 /src/gui/math3d/qvector2d.cpp
parent303915f67c2e797d8c9697466266e1f5c1bf45c6 (diff)
downloadQt-bc9ced591a81293a155800cb28771f3bac17a9d2.zip
Qt-bc9ced591a81293a155800cb28771f3bac17a9d2.tar.gz
Qt-bc9ced591a81293a155800cb28771f3bac17a9d2.tar.bz2
Add implicit conversions from math3d classes to QVariant
Existing QVariant-capable classes in QtGui like QColor, QPixmap, etc have "operator QVariant()". This change adds the same operators for QVector2D, QVector3D, QVector4D, QQuaternion, and QMatrix4x4. Reviewed-by: Justin McPherson
Diffstat (limited to 'src/gui/math3d/qvector2d.cpp')
-rw-r--r--src/gui/math3d/qvector2d.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index 1662020..35c86a1 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -43,6 +43,7 @@
#include "qvector3d.h"
#include "qvector4d.h"
#include <QtCore/qdebug.h>
+#include <QtCore/qvariant.h>
#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -402,6 +403,14 @@ QVector4D QVector2D::toVector4D() const
\sa toPoint(), toVector3D()
*/
+/*!
+ Returns the 2D vector as a QVariant.
+*/
+QVector2D::operator QVariant() const
+{
+ return QVariant(QVariant::Vector2D, this);
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVector2D &vector)