Fix loss of precision warnings

Found by http://www.viva64.com/en/b/0251

Change-Id: I2a0c3dba74fef07c3119c9e57b343a8253ee7daa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-05-14 18:43:50 +02:00 committed by The Qt Project
parent 385692b3ad
commit 92c6bfa0b2
2 changed files with 3 additions and 3 deletions

View File

@ -458,8 +458,8 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
// Z = sin(altitude) // Z = sin(altitude)
// X Tilt = arctan(X / Z) // X Tilt = arctan(X / Z)
// Y Tilt = arctan(Y / Z) // Y Tilt = arctan(Y / Z)
const double radAzim = (packet.pkOrientation.orAzimuth / 10) * (M_PI / 180); const double radAzim = (packet.pkOrientation.orAzimuth / 10.0) * (M_PI / 180);
const double tanAlt = tan((abs(packet.pkOrientation.orAltitude / 10)) * (M_PI / 180)); const double tanAlt = tan((abs(packet.pkOrientation.orAltitude / 10.0)) * (M_PI / 180));
const double degX = atan(sin(radAzim) / tanAlt); const double degX = atan(sin(radAzim) / tanAlt);
const double degY = atan(cos(radAzim) / tanAlt); const double degY = atan(cos(radAzim) / tanAlt);

View File

@ -331,7 +331,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
int elapsedTime = d->time.restart(); int elapsedTime = d->time.restart();
if (!elapsedTime) if (!elapsedTime)
elapsedTime = 1; elapsedTime = 1;
d->velocityValue = 0.9 * d->velocityValue + distance / elapsedTime; d->velocityValue = 0.9 * d->velocityValue + (qreal) distance / elapsedTime;
d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
static const int MoveThreshold = 50; static const int MoveThreshold = 50;