From: Andras Becsi Date: Thu, 10 May 2012 13:12:18 +0000 (+0200) Subject: Fix axis locking for AutoFlickDirection X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=1b0d246fb49e408afaed817694ce91aaf52b180b;p=konrad%2Fqtdeclarative.git Fix axis locking for AutoFlickDirection If the flickableDirection property is AutoFlickDirection Flickable compares qreals for equality to decide whether to lock flicking in one direction. This is too restrictive since the content size could have rounding errors withing the one pixel range resulting from pixel alignment and float calculations. Flickable should consider the content width/height equal to its width/height if their difference is within the one pixel range. Change-Id: Id3bff33d6f798860c62c699a6c2795213efe233d Reviewed-by: Martin Jones --- diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index dcb484c..1f7c800 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1763,7 +1763,7 @@ bool QQuickFlickable::xflick() const { Q_D(const QQuickFlickable); if (d->flickableDirection == QQuickFlickable::AutoFlickDirection) - return vWidth() != width(); + return floor(qAbs(vWidth() - width())); return d->flickableDirection & QQuickFlickable::HorizontalFlick; } @@ -1771,7 +1771,7 @@ bool QQuickFlickable::yflick() const { Q_D(const QQuickFlickable); if (d->flickableDirection == QQuickFlickable::AutoFlickDirection) - return vHeight() != height(); + return floor(qAbs(vHeight() - height())); return d->flickableDirection & QQuickFlickable::VerticalFlick; }