diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-02 01:43:32 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-19 19:48:17 +0200 |
commit | 9c89743d726c248785cfed5ea83299e542001018 (patch) | |
tree | b099b6e9476dfc3879bb23e6b8f438d37a562dc6 /src/corelib | |
parent | d95e39a9b8e35d377e8bbcb3dd848c3a5b276016 (diff) |
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qnamespace.h | 6 |
1 files changed, 3 insertions, 3 deletions
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) |