┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-07-25 22:35:37 +0200
committerFrank Reininghaus <[email protected]>2013-07-25 22:35:37 +0200
commit611c935e033bf69895c5a7fd9f96381926c1c82b (patch)
tree0007a4b157959ef0da876b2ab8dfd608222e00f6 /src
parent5e96822ee3d711ad6660da9262c69eadb77ce841 (diff)
parent55a989626d1285590ee7906638215b7a63812e23 (diff)
Merge remote-tracking branch 'origin/KDE/4.11'
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp9
-rw-r--r--src/kitemviews/kitemlistview.cpp28
2 files changed, 24 insertions, 13 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;
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index d2b3fa103..0c3183cd5 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -1635,18 +1635,22 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
widget->resize(itemBounds.size());
if (animate && changedCount < 0) {
- // Items have been deleted, move the created item to the
- // imaginary old position. They will get animated to the new position
- // later.
- const QRectF itemRect = m_layouter->itemRect(i - changedCount);
- if (itemRect.isEmpty()) {
- const QPointF invisibleOldPos = (scrollOrientation() == Qt::Vertical)
- ? QPointF(0, size().height()) : QPointF(size().width(), 0);
- widget->setPos(invisibleOldPos);
- } else {
- widget->setPos(itemRect.topLeft());
+ // Items have been deleted.
+ if (i >= changedIndex) {
+ // The item is located behind the removed range. Move the
+ // created item to the imaginary old position outside the
+ // view. It will get animated to the new position later.
+ const int previousIndex = i - changedCount;
+ const QRectF itemRect = m_layouter->itemRect(previousIndex);
+ if (itemRect.isEmpty()) {
+ const QPointF invisibleOldPos = (scrollOrientation() == Qt::Vertical)
+ ? QPointF(0, size().height()) : QPointF(size().width(), 0);
+ widget->setPos(invisibleOldPos);
+ } else {
+ widget->setPos(itemRect.topLeft());
+ }
+ applyNewPos = false;
}
- applyNewPos = false;
}
if (supportsExpanding && changedCount == 0) {
@@ -1665,7 +1669,7 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
const bool itemsRemoved = (changedCount < 0);
const bool itemsInserted = (changedCount > 0);
- if (itemsRemoved && (i >= changedIndex + changedCount + 1)) {
+ if (itemsRemoved && (i >= changedIndex)) {
// The item is located after the removed items. Animate the moving of the position.
applyNewPos = !moveWidget(widget, newPos);
} else if (itemsInserted && i >= changedIndex) {