summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qvector3d.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-07-23 00:58:55 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-07-23 00:58:55 (GMT)
commitc42f7058dfd7ea551b2d3bca5651b0c802c91259 (patch)
tree216bc85420569a327c198ff4702566688438b99b /src/gui/math3d/qvector3d.cpp
parentb11f173a57128416ce314796e7b0320ad7c05bf7 (diff)
downloadQt-c42f7058dfd7ea551b2d3bca5651b0c802c91259.zip
Qt-c42f7058dfd7ea551b2d3bca5651b0c802c91259.tar.gz
Qt-c42f7058dfd7ea551b2d3bca5651b0c802c91259.tar.bz2
Add the math3d types to QVariant
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/gui/math3d/qvector3d.cpp')
-rw-r--r--src/gui/math3d/qvector3d.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 95550cd..881f47c 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -558,6 +558,49 @@ QDebug operator<<(QDebug dbg, const QVector3D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+ \relates QVector3D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+{
+ stream << double(vector.x()) << double(vector.y())
+ << double(vector.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+ \relates QVector3D
+
+ Reads a 3D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+{
+ double x, y, z;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ vector.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR3D
QT_END_NAMESPACE