summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qvector2d.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-07-23 10:58:55 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-07-23 10:58:55 +1000
commitc42f7058dfd7ea551b2d3bca5651b0c802c91259 (patch)
tree216bc85420569a327c198ff4702566688438b99b /src/gui/math3d/qvector2d.cpp
parentb11f173a57128416ce314796e7b0320ad7c05bf7 (diff)
Add the math3d types to QVariant
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/gui/math3d/qvector2d.cpp')
-rw-r--r--src/gui/math3d/qvector2d.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index b492aa883b..28f6b7ae22 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -410,6 +410,46 @@ QDebug operator<<(QDebug dbg, const QVector2D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
+ \relates QVector2D
+
+ 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 QVector2D &vector)
+{
+ stream << double(vector.x()) << double(vector.y());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+ \relates QVector2D
+
+ Reads a 2D 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, QVector2D &vector)
+{
+ double x, y;
+ stream >> x;
+ stream >> y;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR2D
QT_END_NAMESPACE