diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-03-26 19:23:11 +0100 |
---|---|---|
committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-17 20:30:37 +0200 |
commit | 7f3e43b32c28fc84c465ec2fd6f3f5e188bbf5fb (patch) | |
tree | d7c569ecb5cc7d70887496d7d07c5af43219d68d /src/corelib/global/qnamespace.h | |
parent | d5d9317c3171c14b706b91a93e260f9345c117a0 (diff) |
QKeyCombination: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QKeyCombination to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE macro.
Task-number: QTBUG-120304
Change-Id: I679f3fa5fcc4c675a763cc5a5fe0e0880439a64f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/global/qnamespace.h')
-rw-r--r-- | src/corelib/global/qnamespace.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 4d3b6ab099..2398c0a1a4 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -10,6 +10,7 @@ #endif #include <QtCore/qglobal.h> +#include <QtCore/qcompare.h> #include <QtCore/qtmetamacros.h> #if defined(__OBJC__) && !defined(__cplusplus) @@ -1908,18 +1909,14 @@ public: return combination; } #endif - - friend constexpr bool operator==(QKeyCombination lhs, QKeyCombination rhs) noexcept + bool operator<(QKeyCombination) const = delete; +private: + friend constexpr bool comparesEqual(const QKeyCombination &lhs, + const QKeyCombination &rhs) noexcept { return lhs.combination == rhs.combination; } - - friend constexpr bool operator!=(QKeyCombination lhs, QKeyCombination rhs) noexcept - { - return lhs.combination != rhs.combination; - } - - bool operator<(QKeyCombination) const = delete; + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QKeyCombination) }; Q_DECLARE_TYPEINFO(QKeyCombination, Q_RELOCATABLE_TYPE); |