src/hbcore/gui/hbscrollarea_p.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
--- a/src/hbcore/gui/hbscrollarea_p.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/gui/hbscrollarea_p.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -269,10 +269,26 @@
                 HbWidgetFeedback::triggered(q, Hb::InstantBoundaryReached);
             }
         }
-        stopScrolling(); 
+        bool scrolled = currentPosition != newPosition;
+        if (scrolled) {
+            setContentPosition(-newPosition);
+
+            if (mAbleToScrollX && mHorizontalScrollBar->isVisible()) {
+                updateScrollBar(Qt::Horizontal);
+            }
+            if (mAbleToScrollY && mVerticalScrollBar->isVisible()) {
+                updateScrollBar(Qt::Vertical);
+            }
+        }
+
+        // if animating stopScrolling will be called from _q_animateScrollTimeout
+        if (!mIsAnimating) {
+            stopScrolling();
+        }
+
         // must return here, otherwise mIsScrolling will be false
         // below and scrollingStarted will be emitted
-        return currentPosition != newPosition;
+        return scrolled;
     } else {
         mBoundaryReached = false;
     }
@@ -294,17 +310,16 @@
         }
         stopScrollbarHideTimer();
 
-    } else {
-
-        if (mAbleToScrollX && mHorizontalScrollBar->isVisible()) {
-            updateScrollBar(Qt::Horizontal);
-        }
+    }
 
-        if (mAbleToScrollY && mVerticalScrollBar->isVisible()) {
-            updateScrollBar(Qt::Vertical);
-        }
+    if (mAbleToScrollX && mHorizontalScrollBar->isVisible()) {
+        updateScrollBar(Qt::Horizontal);
     }
-    //if we are here than content position has changed.i.e delta is not zero or
+    if (mAbleToScrollY && mVerticalScrollBar->isVisible()) {
+        updateScrollBar(Qt::Vertical);
+    }
+
+        //if we are here than content position has changed.i.e delta is not zero or
     //we havent reached the boundaries.
     return true;
 }
@@ -900,21 +915,17 @@
 void HbScrollAreaPrivate::displayScrollBar(Qt::Orientation orientation)
 {
     Q_Q(HbScrollArea);
-    if (orientation == Qt::Horizontal) {
 
-        // Layout the scrollbar
-        setScrollBarMetrics(orientation);
+    // Layout the scrollbar
+    setScrollBarMetrics(orientation);
 
+    if (orientation == Qt::Horizontal) {
         // Activate the scrollbar
         if ( !mHorizontalScrollBar->isVisible() && q->isVisible()) {
             mHorizontalScrollBar->setVisible(true);
         }
     }
     else if (orientation == Qt::Vertical) {
-
-        // Layout the scrollbar
-        setScrollBarMetrics(orientation);
-
         // Activate the scrollbar
         if ( !mVerticalScrollBar->isVisible() && q->isVisible()) {
             mVerticalScrollBar->setVisible(true);