From 3e2e0dde4797cda4f04347a7f766cc37428ceef6 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 2 May 2021 01:27:23 +0200 Subject: [PATCH] QFlags::setFlag: don't go through Int, go through QFlags itself Avoid a "detour" outside QFlags' type safety: operator~ is defined on QFlags already, use that one. Change-Id: Iedd07d1652b8f92e3881298ceafcd5c761346bb0 Reviewed-by: Thiago Macieira --- src/corelib/global/qflags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 34e2c5bc869..8d538c97f48 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -143,7 +143,7 @@ public: constexpr inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); } constexpr inline QFlags &setFlag(Enum flag, bool on = true) noexcept { - return on ? (*this |= flag) : (*this &= ~Int(flag)); + return on ? (*this |= flag) : (*this &= ~QFlags(flag)); } private: