From 4bed03eb8515d090f476ed69be6331bb513ffaf7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 4 Apr 2014 23:59:37 +0200 Subject: QPageLayout: make op== non-member Better style, since it treats the left-hand and right-hand size symmetrically, e.g. for implicit conversions. Change-Id: Ib5d39b1ebffffcb664ee2f72c756702469e32d3b Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/gui/painting/qpagelayout.cpp | 14 ++++++++------ src/gui/painting/qpagelayout.h | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index 5589a4364c..b48b9f6e4d 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -424,21 +424,23 @@ QPageLayout &QPageLayout::operator=(const QPageLayout &other) */ /*! - Returns \c true if this page layout is equal to the \a other page layout, + \relates QPageLayout + + Returns \c true if page layout \a lhs is equal to page layout \a rhs, i.e. if all the attributes are exactly equal. Note that this is a strict equality, especially for page size where the QPageSize ID, name and size must exactly match, and the margins where the units must match. - \sa isEquivalentTo() + \sa QPageLayout::isEquivalentTo() */ -bool QPageLayout::operator==(const QPageLayout &other) const +bool operator==(const QPageLayout &lhs, const QPageLayout &rhs) { - if (d && other.d) - return (*d == *other.d); - return (d == other.d); + if (lhs.d && rhs.d) + return (*lhs.d == *rhs.d); + return (lhs.d == rhs.d); } /*! diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h index c636ca7476..0ca1682b20 100644 --- a/src/gui/painting/qpagelayout.h +++ b/src/gui/painting/qpagelayout.h @@ -92,7 +92,7 @@ public: void swap(QPageLayout &other) { d.swap(other.d); } - bool operator==(const QPageLayout &other) const; + friend Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs); bool isEquivalentTo(const QPageLayout &other) const; bool isValid() const; @@ -142,6 +142,8 @@ private: Q_DECLARE_SHARED(QPageLayout) +Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs); + #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout); #endif -- cgit v1.2.3