diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-10-30 15:42:51 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-10-31 11:47:19 +0100 |
commit | 3019b82b1b9813b7d23ebc74a40e437cecd60a60 (patch) | |
tree | 06bc1488f1647f3d371a990b913bd3e6bdb9fd08 /src/quick | |
parent | 5be2aee25b08a2b501ca44365c7ca7eb23b1a427 (diff) |
Hide QQuickRenderTarget equality operators from ADL
Also replace Q_DECL_NOTHROW with noexcept.
Task-number: QTBUG-87973
Change-Id: I1471d65076ece5ab6d5efdf0e50b02751789d32b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickrendertarget.cpp | 40 | ||||
-rw-r--r-- | src/quick/items/qquickrendertarget.h | 9 |
2 files changed, 26 insertions, 23 deletions
diff --git a/src/quick/items/qquickrendertarget.cpp b/src/quick/items/qquickrendertarget.cpp index bdaee055a8..69063ecdbe 100644 --- a/src/quick/items/qquickrendertarget.cpp +++ b/src/quick/items/qquickrendertarget.cpp @@ -317,30 +317,39 @@ QQuickRenderTarget QQuickRenderTarget::fromRhiRenderTarget(QRhiRenderTarget *ren } /*! + \fn bool QQuickRenderTarget::operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b) noexcept \return true if \a a and \a b refer to the same set of native objects and have matching associated data (size, sample count). - */ -bool operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b) Q_DECL_NOTHROW +*/ +/*! + \fn bool QQuickRenderTarget::operator!=(const QQuickRenderTarget &a, const QQuickRenderTarget &b) noexcept + + \return true if \a a and \a b refer to a different set of native objects, + or the associated data (size, sample count) does not match. +*/ + +/*! + \internal +*/ +bool QQuickRenderTarget::isEqual(const QQuickRenderTarget &other) const noexcept { - const QQuickRenderTargetPrivate *da = QQuickRenderTargetPrivate::get(&a); - const QQuickRenderTargetPrivate *db = QQuickRenderTargetPrivate::get(&b); - if (da->type != db->type - || da->pixelSize != db->pixelSize - || da->sampleCount != db->sampleCount) + if (d->type != other.d->type + || d->pixelSize != other.d->pixelSize + || d->sampleCount != other.d->sampleCount) { return false; } - switch (da->type) { + switch (d->type) { case QQuickRenderTargetPrivate::Type::Null: break; case QQuickRenderTargetPrivate::Type::NativeTexture: - if (da->u.nativeTexture.object != db->u.nativeTexture.object - || da->u.nativeTexture.layout != db->u.nativeTexture.layout) + if (d->u.nativeTexture.object != other.d->u.nativeTexture.object + || d->u.nativeTexture.layout != other.d->u.nativeTexture.layout) return false; break; case QQuickRenderTargetPrivate::Type::RhiRenderTarget: - if (da->u.rhiRt != db->u.rhiRt) + if (d->u.rhiRt != other.d->u.rhiRt) return false; break; default: @@ -350,15 +359,6 @@ bool operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b) Q_DECL return true; } -/*! - \return true if \a a and \a b refer to a different set of native objects, - or the associated data (size, sample count) does not match. - */ -bool operator!=(const QQuickRenderTarget &a, const QQuickRenderTarget &b) Q_DECL_NOTHROW -{ - return !(a == b); -} - bool QQuickRenderTargetPrivate::resolve(QRhi *rhi, QQuickWindowRenderTarget *dst) { switch (type) { diff --git a/src/quick/items/qquickrendertarget.h b/src/quick/items/qquickrendertarget.h index 95070b0a63..26b301c4ff 100644 --- a/src/quick/items/qquickrendertarget.h +++ b/src/quick/items/qquickrendertarget.h @@ -86,12 +86,15 @@ public: private: void detach(); + bool isEqual(const QQuickRenderTarget &other) const noexcept; QQuickRenderTargetPrivate *d; friend class QQuickRenderTargetPrivate; -}; -Q_QUICK_EXPORT bool operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b) Q_DECL_NOTHROW; -Q_QUICK_EXPORT bool operator!=(const QQuickRenderTarget &a, const QQuickRenderTarget &b) Q_DECL_NOTHROW; + friend bool operator==(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept + { return lhs.isEqual(rhs); } + friend bool operator!=(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept + { return !lhs.isEqual(rhs); } +}; QT_END_NAMESPACE |