From 9c89743d726c248785cfed5ea83299e542001018 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 2 May 2021 01:43:32 +0200 Subject: QKeyCombination: code tidies * Use the new QFlags::toInt() instead of an explicit cast. * Don't apply ~ to an enumerator and then convert the result to an int; instead, convert the enumerator to int and then bitwise negate it. The former is going to break in an upcoming commit. Change-Id: I3a798d61452891d2f61f84e2d8e17237f47c5659 Reviewed-by: Volker Hilsheimer --- src/corelib/global/qnamespace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/global/qnamespace.h') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 6555e7c4f4..48bbba655e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1874,11 +1874,11 @@ public: {} constexpr explicit QKeyCombination(Qt::Modifiers modifiers, Qt::Key key = Qt::Key_unknown) noexcept - : combination(int(modifiers) | int(key)) + : combination(modifiers.toInt() | int(key)) {} constexpr explicit QKeyCombination(Qt::KeyboardModifiers modifiers, Qt::Key key = Qt::Key_unknown) noexcept - : combination(int(modifiers) | int(key)) + : combination(modifiers.toInt() | int(key)) {} constexpr Qt::KeyboardModifiers keyboardModifiers() const noexcept @@ -1888,7 +1888,7 @@ public: constexpr Qt::Key key() const noexcept { - return Qt::Key(combination & ~Qt::KeyboardModifierMask); + return Qt::Key(combination & ~int(Qt::KeyboardModifierMask)); } static constexpr QKeyCombination fromCombined(int combined) -- cgit v1.2.3