summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qpoint.h
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
committerLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
commit096e37910d93f9c52976600e985c615ea36fe291 (patch)
tree713d020f4a04f03d8ca6e111055e7eebe85953a8 /src/corelib/tools/qpoint.h
parent88eda007a3b5046999dd0b287634765efcd8934d (diff)
parenta14a943f9ac3d1e85514d7fb6688c84e624ac850 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
Diffstat (limited to 'src/corelib/tools/qpoint.h')
-rw-r--r--src/corelib/tools/qpoint.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 0f3e0c3517..ae46f0d39f 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -345,16 +345,24 @@ Q_DECL_RELAXED_CONSTEXPR inline QPointF &QPointF::operator*=(qreal c)
xp*=c; yp*=c; return *this;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
+
Q_DECL_CONSTEXPR inline bool operator==(const QPointF &p1, const QPointF &p2)
{
- return qFuzzyIsNull(p1.xp - p2.xp) && qFuzzyIsNull(p1.yp - p2.yp);
+ 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));
}
Q_DECL_CONSTEXPR inline bool operator!=(const QPointF &p1, const QPointF &p2)
{
- return !qFuzzyIsNull(p1.xp - p2.xp) || !qFuzzyIsNull(p1.yp - p2.yp);
+ return !(p1 == p2);
}
+QT_WARNING_POP
+
Q_DECL_CONSTEXPR inline const QPointF operator+(const QPointF &p1, const QPointF &p2)
{
return QPointF(p1.xp+p2.xp, p1.yp+p2.yp);