Make QAccessible::State's equality operator a hidden friend

Reduce ADL nose.

We already have an inline default constructor calling memset, so can have
the comparison operator calling memcmp also inlined.

Task-number: QTBUG-87973
Change-Id: If8e0ae98b0c44fc3fddac7ef57c5ff021c80dad6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-10-28 10:02:48 +01:00
parent a45a3b1ece
commit be10808279
2 changed files with 4 additions and 8 deletions

View File

@ -1820,12 +1820,6 @@ const char *qAccessibleEventString(QAccessible::Event event)
return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
}
/*! \internal */
bool operator==(const QAccessible::State &first, const QAccessible::State &second)
{
return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
}
#ifndef QT_NO_DEBUG_STREAM
/*! \internal */
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)

View File

@ -217,6 +217,10 @@ public:
State() {
memset(this, 0, sizeof(State));
}
friend inline bool operator==(const QAccessible::State &first, const QAccessible::State &second)
{
return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
}
};
@ -437,8 +441,6 @@ private:
friend class QAccessibleCache;
};
Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)
class QAccessible2Interface;