diff options
Diffstat (limited to 'src/corelib/global/qflags.h')
-rw-r--r-- | src/corelib/global/qflags.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index e181566fdb..b907caa9b6 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -145,6 +145,11 @@ public: Q_DECL_CONSTEXPR inline bool operator!() const Q_DECL_NOTHROW { return !i; } Q_DECL_CONSTEXPR inline bool testFlag(Enum f) const Q_DECL_NOTHROW { return (i & Int(f)) == Int(f) && (Int(f) != 0 || i == Int(f) ); } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum f, bool on = true) Q_DECL_NOTHROW + { + return on ? (*this |= f) : (*this &= ~f); + } + private: #ifdef Q_COMPILER_INITIALIZER_LISTS Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it, |