summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qnamespace.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-05-02 01:43:32 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-05-19 19:48:17 +0200
commit9c89743d726c248785cfed5ea83299e542001018 (patch)
treeb099b6e9476dfc3879bb23e6b8f438d37a562dc6 /src/corelib/global/qnamespace.h
parentd95e39a9b8e35d377e8bbcb3dd848c3a5b276016 (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/global/qnamespace.h')
-rw-r--r--src/corelib/global/qnamespace.h6
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)