From 1b0d246fb49e408afaed817694ce91aaf52b180b Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Thu, 10 May 2012 15:12:18 +0200 Subject: [PATCH] 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 --- src/quick/items/qquickflickable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.7.4