From 5a0faa9198c6ae6e21a550159c4284d1a9c5792e Mon Sep 17 00:00:00 2001 From: Tatiana Borisova Date: Tue, 30 Apr 2024 15:27:02 +0200 Subject: 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 --- src/corelib/kernel/qmetaobject_p.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/corelib/kernel/qmetaobject_p.h') 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(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; }; -- cgit v1.2.3