┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistcontainer.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-07-25 22:25:18 +0200
committerFrank Reininghaus <[email protected]>2013-07-25 22:25:18 +0200
commit55a989626d1285590ee7906638215b7a63812e23 (patch)
tree2f473faa933526f5c8cdc102aed949893046c747 /src/kitemviews/kitemlistcontainer.cpp
parent08c2f7f5fbc55939626842e5764df856c8972d66 (diff)
Fix maximum value for scroll bar when deleting items in Details View
The problem was that the view heigt minus the header height was subtracted from maximumScrollOffset() to determine the maximum value of the scroll offset of the top of the view. However, the top of the view is the part that is hiden behind the header. Therefore, the full view height must be subtracted from maximumScrollOffset. The remaining bits of bug 319951 were fixed by other recent commits. Thanks to Emmanuel Pescosta for helping to track down the problem! BUG: 319951 FIXED-IN: 4.11.0 REVIEW: 111486
Diffstat (limited to 'src/kitemviews/kitemlistcontainer.cpp')
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index 3bd8067a8..f2e94b733 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -257,6 +257,7 @@ void KItemListContainer::updateScrollOffsetScrollBar()
QScrollBar* scrollOffsetScrollBar = 0;
int singleStep = 0;
int pageStep = 0;
+ int maximum = 0;
if (view->scrollOrientation() == Qt::Vertical) {
smoothScroller = m_verticalSmoothScroller;
scrollOffsetScrollBar = verticalScrollBar();
@@ -264,15 +265,21 @@ void KItemListContainer::updateScrollOffsetScrollBar()
// We cannot use view->size().height() because this height might
// include the header widget, which is not part of the scrolled area.
pageStep = view->verticalPageStep();
+
+ // However, the total height of the view must be considered for the
+ // maximum value of the scroll bar. Note that the view's scrollOffset()
+ // refers to the offset of the top part of the view, which might be
+ // hidden behind the header.
+ maximum = qMax(0, int(view->maximumScrollOffset() - view->size().height()));
} else {
smoothScroller = m_horizontalSmoothScroller;
scrollOffsetScrollBar = horizontalScrollBar();
singleStep = view->itemSize().width();
pageStep = view->size().width();
+ maximum = qMax(0, int(view->maximumScrollOffset() - view->size().width()));
}
const int value = view->scrollOffset();
- const int maximum = qMax(0, int(view->maximumScrollOffset() - pageStep));
if (smoothScroller->requestScrollBarUpdate(maximum)) {
const bool updatePolicy = (scrollOffsetScrollBar->maximum() > 0 && maximum == 0)
|| horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOn;