]> cloud.milkyroute.net Git - dolphin.git/commitdiff
KItemListContainer: show only the scroll bar that is needed
authorFrank Reininghaus <frank78ac@googlemail.com>
Sat, 13 Aug 2011 12:34:17 +0000 (14:34 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 13 Aug 2011 12:35:18 +0000 (14:35 +0200)
Up to now, KItemListContainer would show both a vertical and
horizontal scroll bar after a view mode change. This commit
fixes that by setting the maximum and the value of the scroll
bar that is not needed to 0 in
KItemListContainer::updateScrollBars().

src/kitemviews/kitemlistcontainer.cpp

index 906f44640f6ab165ea043e76313071bb19335729..28e526a6f04def5e1055c53ecd102a0bf1d2a64a 100644 (file)
@@ -232,14 +232,17 @@ void KItemListContainer::updateScrollBars()
     QScrollBar* scrollBar = 0;
     int singleStep = 0;
     int pageStep = 0;
+    QScrollBar* otherScrollBar = 0;
     if (view->scrollOrientation() == Qt::Vertical) {
         scrollBar = verticalScrollBar();
         singleStep = view->itemSize().height();
         pageStep = view->size().height();
+        otherScrollBar = horizontalScrollBar();
     } else {
         scrollBar = horizontalScrollBar();
         singleStep = view->itemSize().width();
         pageStep = view->size().width();
+        otherScrollBar = verticalScrollBar();
     }
 
     const int value = view->offset();
@@ -263,6 +266,10 @@ void KItemListContainer::updateScrollBars()
     scrollBar->setMinimum(0);
     scrollBar->setMaximum(maximum);
     scrollBar->setValue(value);
+
+    // Make sure that the other scroll bar is hidden
+    otherScrollBar->setMaximum(0);
+    otherScrollBar->setValue(0);
 }
 
 void KItemListContainer::updateGeometries()