summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qpagelayout.cpp14
-rw-r--r--src/gui/painting/qpagelayout.h2
-rw-r--r--tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp4
3 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp
index b48b9f6e4d..d9e826bd64 100644
--- a/src/gui/painting/qpagelayout.cpp
+++ b/src/gui/painting/qpagelayout.cpp
@@ -444,6 +444,20 @@ bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
}
/*!
+ \fn bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
+ \relates QPageLayout
+
+ Returns \c true if page layout \a lhs is not equal to page layout \a rhs,
+ i.e. if any of the attributes differ.
+
+ 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 QPageLayout::isEquivalentTo()
+*/
+
+/*!
Returns \c true if this page layout is equivalent to the \a other page layout,
i.e. if the page has the same size, margins and orientation.
*/
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
index 0ca1682b20..e63f6f4d39 100644
--- a/src/gui/painting/qpagelayout.h
+++ b/src/gui/painting/qpagelayout.h
@@ -143,6 +143,8 @@ private:
Q_DECLARE_SHARED(QPageLayout)
Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs);
+inline bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
+{ return !operator==(lhs, rhs); }
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout);
diff --git a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
index 30d25f00d2..5f452b5602 100644
--- a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
+++ b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
@@ -83,8 +83,12 @@ void tst_QPageLayout::basics()
QCOMPARE(simple.paintRectPoints(), QRect(0, 0, 595, 842));
QCOMPARE(simple.paintRectPixels(72), QRect(0, 0, 595, 842));
+ const QPageLayout a4portrait = simple;
+ QVERIFY(a4portrait == simple);
+
// Change orientation
simple.setOrientation(QPageLayout::Landscape);
+ QVERIFY(simple != a4portrait);
QCOMPARE(simple.orientation(), QPageLayout::Landscape);
QCOMPARE(simple.margins(), QMarginsF(0, 0, 0, 0));
QCOMPARE(simple.minimumMargins(), QMarginsF(0, 0, 0, 0));