From: Frank Reininghaus Date: Sat, 13 Aug 2011 12:34:17 +0000 (+0200) Subject: KItemListContainer: show only the scroll bar that is needed X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/fabf5681f5ae71e7ad7cc1c4876917a31b9b40a6 KItemListContainer: show only the scroll bar that is needed 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(). --- diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 906f44640..28e526a6f 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -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()