From 51420d910ba1b61e420db82ed5b709e158edada8 Mon Sep 17 00:00:00 2001 From: Tatiana Borisova Date: Fri, 19 Apr 2024 13:09:46 +0200 Subject: QMetaMethod: use new comparison helper macros Replace public friend operators operator==(), operator!=() of QMetaMethod to friend method comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macro. Task-number: QTBUG-120304 Change-Id: Idb3f880a1db4850d73a58ed37f8cbd3454dd5ea2 Reviewed-by: Ivan Solovev --- src/corelib/kernel/qmetaobject.cpp | 9 +++++---- src/corelib/kernel/qmetaobject.h | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 8d304bd890..148983f126 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1798,6 +1798,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * function. \ingroup objectmodel + \compares equality A QMetaMethod has a methodType(), a methodSignature(), a list of parameterTypes() and parameterNames(), a return typeName(), a @@ -1825,19 +1826,19 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * invoked), otherwise returns \c false. */ -/*! \fn bool QMetaMethod::operator==(const QMetaMethod &m1, const QMetaMethod &m2) +/*! \fn bool QMetaMethod::operator==(const QMetaMethod &lhs, const QMetaMethod &rhs) \since 5.0 \overload - Returns \c true if method \a m1 is equal to method \a m2, + Returns \c true if method \a lhs is equal to method \a rhs, otherwise returns \c false. */ -/*! \fn bool QMetaMethod::operator!=(const QMetaMethod &m1, const QMetaMethod &m2) +/*! \fn bool QMetaMethod::operator!=(const QMetaMethod &lhs, const QMetaMethod &rhs) \since 5.0 \overload - Returns \c true if method \a m1 is not equal to method \a m2, + Returns \c true if method \a lhs is not equal to method \a rhs, otherwise returns \c false. */ diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index 4e52e854d9..91f287a8d3 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -6,6 +6,7 @@ #define QMETAOBJECT_H #include +#include #include QT_BEGIN_NAMESPACE @@ -251,10 +252,11 @@ protected: friend struct QMetaObject; friend struct QMetaObjectPrivate; friend class QObject; - friend bool operator==(const QMetaMethod &m1, const QMetaMethod &m2) noexcept - { return m1.data == m2.data; } - friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) noexcept - { return !(m1 == m2); } + +private: + friend bool comparesEqual(const QMetaMethod &lhs, const QMetaMethod &rhs) noexcept + { return lhs.data == rhs.data; } + Q_DECLARE_EQUALITY_COMPARABLE(QMetaMethod) }; Q_DECLARE_TYPEINFO(QMetaMethod, Q_RELOCATABLE_TYPE); -- cgit v1.2.3