diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-30 15:27:02 +0200 |
---|---|---|
committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-05-10 21:54:54 +0200 |
commit | 5a0faa9198c6ae6e21a550159c4284d1a9c5792e (patch) | |
tree | 4bb864f28f5a995b9f657898fc26ea994d5253c0 /src/corelib/kernel/qmetaobject_p.h | |
parent | ced943e936e335a16e9b479a2010e5bbee1af4f1 (diff) |
QMetaType: use modern comparisons
Internal QPropertyBindingPrivatePtr, QArgumentType classes
also have been updated;
Replace class operators operator==(), operator!=() of
QRegularExpression to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.
Task-number: QTBUG-120304
Change-Id: I010617cbcb8bd6afb7c21ee4345398648821f72c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetaobject_p.h')
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index d2c36fceb4..d5dc9a356a 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -111,22 +111,18 @@ public: const_cast<QArgumentType *>(this)->_name = QMetaType(_type).name(); return _name; } - bool operator==(const QArgumentType &other) const - { - if (_type && other._type) - return _type == other._type; - else - return name() == other.name(); - } - bool operator!=(const QArgumentType &other) const + +private: + friend bool comparesEqual(const QArgumentType &lhs, + const QArgumentType &rhs) noexcept { - if (_type && other._type) - return _type != other._type; + if (lhs._type && rhs._type) + return lhs._type == rhs._type; else - return name() != other.name(); + return lhs.name() == rhs.name(); } + Q_DECLARE_EQUALITY_COMPARABLE(QArgumentType) -private: int _type; QByteArray _name; }; |