# HG changeset patch # User Teemu Piippo # Date 1521833797 -7200 # Node ID d94cf95608ac2740552c4e00239f36a55b4d1ed5 # Parent 4baed9f54de36f4bd2891b7ea9ffceee84317fdb added stream operators to Vertex diff -r 4baed9f54de3 -r d94cf95608ac src/basics.cpp --- a/src/basics.cpp Fri Mar 23 21:30:24 2018 +0200 +++ b/src/basics.cpp Fri Mar 23 21:36:37 2018 +0200 @@ -192,6 +192,16 @@ }; } +QDataStream& operator<<(QDataStream& out, const Vertex& vertex) +{ + return out << vertex.x << vertex.y << vertex.z; +} + +QDataStream& operator>>(QDataStream& in, Vertex& vertex) +{ + return in >> vertex.x >> vertex.y >> vertex.z; +} + // ============================================================================= // BoundingBox::BoundingBox() diff -r 4baed9f54de3 -r d94cf95608ac src/basics.h --- a/src/basics.h Fri Mar 23 21:30:24 2018 +0200 +++ b/src/basics.h Fri Mar 23 21:36:37 2018 +0200 @@ -131,6 +131,9 @@ Q_DECLARE_METATYPE (Vertex) uint qHash(const Vertex& key); +QDataStream& operator<<(QDataStream& out, const Vertex& vertex); +QDataStream& operator>>(QDataStream& in, Vertex& vertex); + static inline qreal abs(const QVector3D &vector) { diff -r 4baed9f54de3 -r d94cf95608ac src/main.cpp --- a/src/main.cpp Fri Mar 23 21:30:24 2018 +0200 +++ b/src/main.cpp Fri Mar 23 21:36:37 2018 +0200 @@ -33,6 +33,8 @@ qRegisterMetaType("Libraries"); qRegisterMetaTypeStreamOperators("Library"); qRegisterMetaTypeStreamOperators("Libraries"); + qRegisterMetaType("Vertex"); + qRegisterMetaTypeStreamOperators("Vertex"); static Configuration configObject; config = &configObject;