From 02b3d43fd4661271e6e8dc8940d84cb2ba352fe0 Mon Sep 17 00:00:00 2001 From: Luca Beldi Date: Wed, 22 Aug 2018 08:21:01 +0100 Subject: _q_interpolate is unsafe with unsigned template arguments _q_interpolate subtracts 2 arguments of type T, for unsigned types this can cause wrapping around Task-number: QTBUG-57925 Change-Id: Iffa59f413579a3d5de8cb728fe71443d8e8a04aa Reviewed-by: Giuseppe D'Angelo --- src/corelib/animation/qvariantanimation_p.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index 37318a5339..9f0f2e3030 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -58,6 +58,8 @@ #include "private/qabstractanimation_p.h" +#include + #ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE @@ -104,7 +106,17 @@ public: }; //this should make the interpolation faster -template inline T _q_interpolate(const T &f, const T &t, qreal progress) +template +typename std::enable_if::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) +{ + return T(f + t * progress - f * progress); +} + +// the below will apply also to all non-arithmetic types +template +typename std::enable_if::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) { return T(f + (t - f) * progress); } -- cgit v1.2.3 From 972dd1c54484179ef0213598e85da981a7d7601f Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 21 Aug 2018 14:52:24 +0200 Subject: Doc: fix typo in QNativeGestureEvent docs Change-Id: I83ac3463752488d7dbb758ea767ba186ddd3fa2a Reviewed-by: Friedemann Kleint --- src/gui/kernel/qevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index adc83302cf..4207697c01 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2750,7 +2750,7 @@ Qt::MouseButtons QTabletEvent::buttons() const \header \li Event Type \li Description - \li Touch equence + \li Touch sequence \row \li Qt::ZoomNativeGesture \li Magnification delta in percent. -- cgit v1.2.3