summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qflags.h4
-rw-r--r--src/corelib/io/qdatastream.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 93dbedc930..feeb488acd 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+class QDataStream;
+
class QFlag
{
int i;
@@ -95,6 +97,8 @@ class QFlags
struct Private;
typedef int (Private::*Zero);
+ template <typename E> friend QDataStream &operator>>(QDataStream &, QFlags<E> &);
+ template <typename E> friend QDataStream &operator<<(QDataStream &, QFlags<E>);
public:
#if defined(Q_CC_MSVC) || defined(Q_QDOC)
// see above for MSVC
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index ecd55f71ae..db1bbfbd63 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -359,6 +359,14 @@ inline QDataStream &QDataStream::operator<<(quint32 i)
inline QDataStream &QDataStream::operator<<(quint64 i)
{ return *this << qint64(i); }
+template <typename Enum>
+inline QDataStream &operator<<(QDataStream &s, QFlags<Enum> e)
+{ return s << e.i; }
+
+template <typename Enum>
+inline QDataStream &operator>>(QDataStream &s, QFlags<Enum> &e)
+{ return s >> e.i; }
+
template <typename T>
inline QDataStream &operator>>(QDataStream &s, QList<T> &l)
{