Skip to content

Commit 0581ed6

Browse files
committed
QQuaternion: fix remaining qFuzzyCompare() precondition violations
qFuzzyCompare() requires that neither argument is numerically zero. This cannot be guaranteed for the quaternion elements. Fix by using the new QtPrivate::fuzzyCompare() function, which does things in the correct way. As a drive-by, put the operators at the beginning of continued lines, as requested by https://wiki.qt.io/Qt_Coding_Style#Line_breaks Item 2. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: Ia317aa260ffc9fb04c10c24517a1ca3be58a1b05 Reviewed-by: Ivan Solovev <[email protected]>
1 parent 9c01b63 commit 0581ed6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/gui/math3d/qquaternion.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@ constexpr QQuaternion operator/(const QQuaternion &quaternion, float divisor)
305305

306306
constexpr bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2) noexcept
307307
{
308-
return qFuzzyCompare(q1.wp, q2.wp) &&
309-
qFuzzyCompare(q1.xp, q2.xp) &&
310-
qFuzzyCompare(q1.yp, q2.yp) &&
311-
qFuzzyCompare(q1.zp, q2.zp);
308+
return QtPrivate::fuzzyCompare(q1.wp, q2.wp)
309+
&& QtPrivate::fuzzyCompare(q1.xp, q2.xp)
310+
&& QtPrivate::fuzzyCompare(q1.yp, q2.yp)
311+
&& QtPrivate::fuzzyCompare(q1.zp, q2.zp);
312312
}
313313

314314
#if QT_GUI_INLINE_IMPL_SINCE(6, 11)

0 commit comments

Comments
 (0)