summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qpagesize.cpp8
-rw-r--r--src/gui/painting/qpagesize.h2
-rw-r--r--tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp3
3 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index 9cf7f192e8..60ca69d1f2 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -1268,6 +1268,14 @@ bool operator==(const QPageSize &lhs, const QPageSize &rhs)
return true;
return lhs.d && rhs.d && *lhs.d == *rhs.d;
}
+/*!
+ \fn bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
+ \relates QPageSize
+
+ Returns \c true if page size \a lhs is unequal to page size \a
+ rhs, i.e. if the page size has different attributes. Current
+ attributes are size and name.
+*/
/*!
Returns \c true if this page is equivalent to the \a other page, i.e. if the
diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h
index d228f05a4a..8205d2eae4 100644
--- a/src/gui/painting/qpagesize.h
+++ b/src/gui/painting/qpagesize.h
@@ -299,6 +299,8 @@ private:
Q_DECLARE_SHARED(QPageSize)
Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs);
+inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
+{ return !operator==(lhs, rhs); }
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize);
diff --git a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
index 968c5ff617..c54f2350e5 100644
--- a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
+++ b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
@@ -137,10 +137,13 @@ void tst_QPageSize::basics()
// Comparisons
QCOMPARE((a4 == folio), false);
+ QCOMPARE((a4 != folio), true);
QCOMPARE((a4.isEquivalentTo(folio)), false);
QCOMPARE((a4 == a4b), true);
+ QCOMPARE((a4 != a4b), false);
QCOMPARE((a4.isEquivalentTo(a4b)), true);
QCOMPARE((folio == folio2), false); // Name different
+ QCOMPARE((folio != folio2), true); // Name different
QCOMPARE((folio.isEquivalentTo(folio2)), true);
// Simple QSize in Millimeters