diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-02 01:27:23 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-03 02:54:10 +0200 |
commit | 3e2e0dde4797cda4f04347a7f766cc37428ceef6 (patch) | |
tree | 76d39b8abb705104601c6637dd5fbc96ef9cb82e /src/corelib/global/qflags.h | |
parent | e4ed47ef4a7fafbc63febc58d13eca247db64a05 (diff) |
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>
Diffstat (limited to 'src/corelib/global/qflags.h')
-rw-r--r-- | src/corelib/global/qflags.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 34e2c5bc86..8d538c97f4 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: |