┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-03-11 18:18:25 +0100
committerFrank Reininghaus <[email protected]>2013-03-11 18:18:44 +0100
commit9ea5eb2164a26905034d8d3902e3a483cee8b8fa (patch)
tree1e5892bfd282c77701e8b89009765f66556a5a10
parent9dd728cb98e0ea822248c641aef5d66f2476768e (diff)
Do not skip rows in when clicking the empty area of the scroll bar
The height of the header widget must be subtracted from the view's height in Details View to determine the "pageStep" for the scroll bar. BUG: 315619 FIXED-IN: 4.10.2 REVIEW: 109210
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp4
-rw-r--r--src/kitemviews/kitemlistview.cpp9
-rw-r--r--src/kitemviews/kitemlistview.h6
3 files changed, 18 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index 5500851c8..3bd8067a8 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -261,7 +261,9 @@ void KItemListContainer::updateScrollOffsetScrollBar()
smoothScroller = m_verticalSmoothScroller;
scrollOffsetScrollBar = verticalScrollBar();
singleStep = view->itemSize().height();
- pageStep = view->size().height();
+ // 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();
} else {
smoothScroller = m_horizontalSmoothScroller;
scrollOffsetScrollBar = horizontalScrollBar();
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 6a68ae798..9ebad7f8b 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -388,6 +388,15 @@ void KItemListView::setGeometry(const QRectF& rect)
}
}
+qreal KItemListView::verticalPageStep() const
+{
+ qreal headerHeight = 0;
+ if (m_headerWidget->isVisible()) {
+ headerHeight = m_headerWidget->size().height();
+ }
+ return size().height() - headerHeight;
+}
+
int KItemListView::itemAt(const QPointF& pos) const
{
QHashIterator<int, KItemListWidget*> it(m_visibleItems);
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 2baf20c94..cd59ddcb5 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -163,6 +163,12 @@ public:
virtual void setGeometry(const QRectF& rect);
/**
+ * @return The page step which should be used by the vertical scroll bar.
+ * This is the height of the view except for the header widget.
+ */
+ qreal verticalPageStep() const;
+
+ /**
* @return Index of the item that is below the point \a pos.
* The position is relative to the upper right of
* the visible area. Only (at least partly) visible