summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qquaternion.cpp
diff options
context:
space:
mode:
authorPeter Yard <peter.yard@nokia.com>2009-07-24 04:20:16 (GMT)
committerPeter Yard <peter.yard@nokia.com>2009-07-24 04:20:16 (GMT)
commited159f974aa99e2ba3cc3112f7e3a1ced26b14b1 (patch)
treea0fbfb009316f8fb9b2600db7a86fadbeef966e4 /src/gui/math3d/qquaternion.cpp
parent3d272951dc9f055e9fc5064098f6a165a8c3e623 (diff)
parent9ec431c161202d9f06f3a7c59181cb0ab523958a (diff)
downloadQt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.zip
Qt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.tar.gz
Qt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui/math3d/qquaternion.cpp')
-rw-r--r--src/gui/math3d/qquaternion.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index d9d4160..841a4c0 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -571,6 +571,51 @@ QDebug operator<<(QDebug dbg, const QQuaternion &q)
#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Writes the given \a quaternion to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+{
+ stream << double(quaternion.scalar()) << double(quaternion.x())
+ << double(quaternion.y()) << double(quaternion.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Reads a quaternion from the given \a stream into the given \a quaternion
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+{
+ double scalar, x, y, z;
+ stream >> scalar;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ quaternion.setScalar(qreal(scalar));
+ quaternion.setX(qreal(x));
+ quaternion.setY(qreal(y));
+ quaternion.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
#endif
QT_END_NAMESPACE