summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-10-21 21:55:04 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-10-23 01:57:27 +0200
commitcca62a7360a117880eea5821fd7403d68a1431c8 (patch)
treeac8b085d664199d4324f8843330b220235da6ac5
parentf595c1523e28dbdcd5b6d8455af7e4fc815bccfc (diff)
QRectF/QPointF/QSizeF: document that operator== and != are fuzzy
This has been the case for a _very_ long time, and I can't believe this hasn't been documented anywhere. Change-Id: Ib157edf14e87a6f546c155496f70a760ab218cca Pick-to: 5.15 5.12 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/corelib/tools/qpoint.cpp16
-rw-r--r--src/corelib/tools/qrect.cpp14
-rw-r--r--src/corelib/tools/qsize.cpp15
3 files changed, 37 insertions, 8 deletions
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index e02fe2e41c..942ae995d5 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -755,13 +755,25 @@ size_t qHash(QPoint key, size_t seed) noexcept
/*!
\fn bool QPointF::operator==(const QPointF &p1, const QPointF &p2)
- Returns \c true if \a p1 is equal to \a p2; otherwise returns \c false.
+ Returns \c true if \a p1 is approximately equal to \a p2; otherwise
+ returns \c false.
+
+ \warning This function does not check for strict equality; instead,
+ it uses a fuzzy comparison to compare the points' coordinates.
+
+ \sa qFuzzyCompare
*/
/*!
\fn bool QPointF::operator!=(const QPointF &p1, const QPointF &p2);
- Returns \c true if \a p1 is not equal to \a p2; otherwise returns \c false.
+ Returns \c true if \a p1 is sufficiently different from \a p2;
+ otherwise returns \c false.
+
+ \warning This function does not check for strict inequality; instead,
+ it uses a fuzzy comparison to compare the points' coordinates.
+
+ \sa qFuzzyCompare
*/
#ifndef QT_NO_DATASTREAM
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 69dc24b5e7..326b0c0cd8 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -2371,8 +2371,13 @@ QRect QRectF::toAlignedRect() const noexcept
\fn bool operator==(const QRectF &r1, const QRectF &r2)
\relates QRectF
- Returns \c true if the rectangles \a r1 and \a r2 are equal,
+ Returns \c true if the rectangles \a r1 and \a r2 are \b approximately equal,
otherwise returns \c false.
+
+ \warning This function does not check for strict equality; instead,
+ it uses a fuzzy comparison to compare the rectangles' coordinates.
+
+ \sa qFuzzyCompare
*/
@@ -2380,8 +2385,11 @@ QRect QRectF::toAlignedRect() const noexcept
\fn bool operator!=(const QRectF &r1, const QRectF &r2)
\relates QRectF
- Returns \c true if the rectangles \a r1 and \a r2 are different, otherwise
- returns \c false.
+ Returns \c true if the rectangles \a r1 and \a r2 are sufficiently
+ different, otherwise returns \c false.
+
+ \warning This function does not check for strict inequality; instead,
+ it uses a fuzzy comparison to compare the rectangles' coordinates.
*/
/*!
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index 57b2cc0319..788356002c 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -743,14 +743,23 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept
/*!
\fn bool QSizeF::operator==(const QSizeF &s1, const QSizeF &s2)
- Returns \c true if \a s1 and \a s2 are equal; otherwise returns
- false.
+ Returns \c true if \a s1 and \a s2 are approximately equal; otherwise
+ returns false.
+
+ \warning This function does not check for strict equality; instead,
+ it uses a fuzzy comparison to compare the sizes' extents.
+
+ \sa qFuzzyCompare
*/
/*!
\fn bool QSizeF::operator!=(const QSizeF &s1, const QSizeF &s2)
- Returns \c true if \a s1 and \a s2 are different; otherwise returns \c false.
+ Returns \c true if \a s1 and \a s2 are sufficiently different; otherwise
+ returns \c false.
+
+ \warning This function does not check for strict inequality; instead,
+ it uses a fuzzy comparison to compare the sizes' extents.
*/
/*!