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 <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2021-05-02 01:27:23 +02:00
parent e4ed47ef4a
commit 3e2e0dde47

View File

@ -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: