diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-07-09 15:30:49 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-07-09 15:38:31 +0000 |
commit | ad8df7215608b69bf2371dbdea36f93886d49f7d (patch) | |
tree | 99bd6eab6db86f79505e270173aa73f13512cc19 /src/corelib/tools/qpoint.h | |
parent | 8c680ab4694052a957887b57fcc324b7b40a8b3f (diff) |
Fix regression in QPointF::operator==
Handle hard zero independently in each coordinate, otherwise hard zero
is never equal to anything but itself.
Task-number: QTBUG-69368
Change-Id: I8b1131472bb92efc706a04e0b067e2211a5ccb0c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/tools/qpoint.h')
-rw-r--r-- | src/corelib/tools/qpoint.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index ae46f0d39f..d7323f7707 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -351,9 +351,8 @@ QT_WARNING_DISABLE_GCC("-Wfloat-equal") Q_DECL_CONSTEXPR inline bool operator==(const QPointF &p1, const QPointF &p2) { - return ((!p1.xp && !p1.yp) || (!p2.xp && !p2.yp)) - ? (qFuzzyIsNull(p1.xp - p2.xp) && qFuzzyIsNull(p1.yp - p2.yp)) - : (qFuzzyCompare(p1.xp, p2.xp) && qFuzzyCompare(p1.yp, p2.yp)); + return ((!p1.xp || !p2.xp) ? qFuzzyIsNull(p1.xp - p2.xp) : qFuzzyCompare(p1.xp, p2.xp)) + && ((!p1.yp || !p2.yp) ? qFuzzyIsNull(p1.yp - p2.yp) : qFuzzyCompare(p1.yp, p2.yp)); } Q_DECL_CONSTEXPR inline bool operator!=(const QPointF &p1, const QPointF &p2) |