diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-19 13:09:46 +0200 |
---|---|---|
committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-30 00:11:33 +0200 |
commit | 51420d910ba1b61e420db82ed5b709e158edada8 (patch) | |
tree | 5e6cd0d0bd9480c8e46713a285ec8e32884c41a0 /src | |
parent | 9ac7e8f4086ad536b816ce7dd7a4a0ec63655e51 (diff) |
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 <ivan.solovev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 9 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject.h | 10 |
2 files changed, 11 insertions, 8 deletions
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 <QtCore/qobjectdefs.h> +#include <QtCore/qcompare.h> #include <QtCore/qvariant.h> 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); |