┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-01-19 19:52:51 +0100
committerFrank Reininghaus <[email protected]>2012-01-19 19:57:51 +0100
commita043163b617d50215ec2fd833b0015617bf41982 (patch)
treec1bb5fbd5d5c20b999c8117b0297f26022d73145 /src/kitemviews/kitemlistview.cpp
parentd13504b5a741e03f9854814df33405700ed0e087 (diff)
Do not make items invisible when turning off previews
This commit fixes a problem in KItemListView::doLayout(): This function assumed that firstVisibleIndex is a constant. However, if the view is scrolled to the bottom with previews enabled, and then previews are disabled (and the icon size is much smaller without previews), this function changes the scroll offset, which also changes the the first visible index. Using the unchanged variable causes trouble later on (i.e., it makes items which are actually inside the view area invisible). lastVisibleIndex is not needed before the scroll offset change and is const after that, so its calculation is moved a few lines down. CCBUG: 291841 FIXED-IN: 4.8.1 (cherry picked from commit cc8f5b4939062df44ce0bd314ac4ae04973b9830)
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index b6af42849..281fe96f8 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -1292,8 +1292,7 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
return;
}
- const int firstVisibleIndex = m_layouter->firstVisibleIndex();
- const int lastVisibleIndex = m_layouter->lastVisibleIndex();
+ int firstVisibleIndex = m_layouter->firstVisibleIndex();
if (firstVisibleIndex < 0) {
emitOffsetChanges();
return;
@@ -1306,8 +1305,11 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
const qreal maxOffsetToShowFullRange = maximumScrollOffset() - visibleOffsetRange;
if (scrollOffset() > maxOffsetToShowFullRange) {
m_layouter->setScrollOffset(qMax(qreal(0), maxOffsetToShowFullRange));
+ firstVisibleIndex = m_layouter->firstVisibleIndex();
}
+ const int lastVisibleIndex = m_layouter->lastVisibleIndex();
+
// Determine all items that are completely invisible and might be
// reused for items that just got (at least partly) visible.
// Items that do e.g. an animated moving of their position are not