From 9f924338a8c003c01864a44569ed2fb4cbba7d2d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 4 Apr 2014 23:59:37 +0200 Subject: QPageSize: make op== non-member Better style, since it treats the left-hand and right-hand size symmetrically, e.g. for implicit conversions. Change-Id: If1ffa9dc2a018e402c884f60bfbc82e799daeb92 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/gui/painting/qpagesize.cpp | 13 ++++++++----- src/gui/painting/qpagesize.h | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index 7d19d49b4e..9cf7f192e8 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1255,15 +1255,18 @@ QPageSize &QPageSize::operator=(const QPageSize &other) */ /*! - Returns \c true if this page is equal to the \a other page, i.e. if the - page has the same attributes. Current attributes are size and name. + \relates QPageSize + + Returns \c true if page size \a lhs is equal to page size \a rhs, + i.e. if the page sizes have the same attributes. Current + attributes are size and name. */ -bool QPageSize::operator==(const QPageSize &other) const +bool operator==(const QPageSize &lhs, const QPageSize &rhs) { - if (d == other.d) + if (lhs.d == rhs.d) return true; - return d && other.d && *d == *other.d; + return lhs.d && rhs.d && *lhs.d == *rhs.d; } /*! diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h index 8b99d6af2e..d228f05a4a 100644 --- a/src/gui/painting/qpagesize.h +++ b/src/gui/painting/qpagesize.h @@ -246,7 +246,7 @@ public: void swap(QPageSize &other) { d.swap(other.d); } - bool operator==(const QPageSize &other) const; + friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs); bool isEquivalentTo(const QPageSize &other) const; bool isValid() const; @@ -298,6 +298,8 @@ private: Q_DECLARE_SHARED(QPageSize) +Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs); + #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize); #endif -- cgit v1.2.3