]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Improve item offset scrolling
authorPeter Penz <peter.penz19@gmail.com>
Mon, 26 Dec 2011 21:28:54 +0000 (22:28 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 26 Dec 2011 21:30:15 +0000 (22:30 +0100)
Don't check whether the m_layoutTimer is active: Changing the
item offset must always trigger a synchronous layout, otherwise
the smooth-scrolling might get jerky.

src/kitemviews/kitemlistview.cpp

index be03606cea158deac84f66867b79954f5a4bcc37..5dbc128b5428af11254d5f176f0f450597177677 100644 (file)
@@ -201,13 +201,19 @@ qreal KItemListView::maximumScrollOffset() const
 
 void KItemListView::setItemOffset(qreal offset)
 {
+    if (m_layouter->itemOffset() == offset) {
+        return;
+    }
+
     m_layouter->setItemOffset(offset);
     if (m_header) {
         m_header->setPos(-offset, 0);
     }
-    if (!m_layoutTimer->isActive()) {
-        doLayout(NoAnimation);
-    }
+
+    // Don't check whether the m_layoutTimer is active: Changing the
+    // item offset must always trigger a synchronous layout, otherwise
+    // the smooth-scrolling might get jerky.
+    doLayout(NoAnimation);
 }
 
 qreal KItemListView::itemOffset() const