summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qflags.h13
-rw-r--r--src/corelib/global/qglobal.cpp24
2 files changed, 37 insertions, 0 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 2396a8b2fe..82fcbdd54d 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -151,6 +151,19 @@ public:
return on ? (*this |= flag) : (*this &= ~QFlags(flag));
}
+ friend constexpr inline bool operator==(QFlags lhs, QFlags rhs) noexcept
+ { return lhs.i == rhs.i; }
+ friend constexpr inline bool operator!=(QFlags lhs, QFlags rhs) noexcept
+ { return lhs.i != rhs.i; }
+ friend constexpr inline bool operator==(QFlags lhs, Enum rhs) noexcept
+ { return lhs == QFlags(rhs); }
+ friend constexpr inline bool operator!=(QFlags lhs, Enum rhs) noexcept
+ { return lhs != QFlags(rhs); }
+ friend constexpr inline bool operator==(Enum lhs, QFlags rhs) noexcept
+ { return QFlags(lhs) == rhs; }
+ friend constexpr inline bool operator!=(Enum lhs, QFlags rhs) noexcept
+ { return QFlags(lhs) != rhs; }
+
private:
constexpr static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
typename std::initializer_list<Enum>::const_iterator end)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index c1a6e7a268..84cb8def80 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -539,6 +539,30 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
*/
/*!
+ \fn template <typename Enum> bool operator==(QFlags<Enum> lhs, QFlags<Enum> rhs)
+ \fn template <typename Enum> bool operator==(QFlags<Enum> lhs, Enum rhs)
+ \fn template <typename Enum> bool operator==(Enum lhs, QFlags<Enum> rhs)
+ \since 6.2
+ \relates QFlags
+
+ Compares \a lhs and \a rhs for equality; the two arguments are
+ considered equal if they represent exactly the same value
+ (bitmask).
+*/
+
+/*!
+ \fn template <typename Enum> bool operator!=(QFlags<Enum> lhs, QFlags<Enum> rhs)
+ \fn template <typename Enum> bool operator!=(QFlags<Enum> lhs, Enum rhs)
+ \fn template <typename Enum> bool operator!=(Enum lhs, QFlags<Enum> rhs)
+ \since 6.2
+ \relates QFlags
+
+ Compares \a lhs and \a rhs for inequality; the two arguments are
+ considered different if they don't represent exactly the same value
+ (bitmask).
+*/
+
+/*!
\macro Q_DISABLE_COPY(Class)
\relates QObject