diff options
| author | Peter Penz <[email protected]> | 2012-02-14 20:57:17 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-14 20:59:08 +0100 |
| commit | 55f46ceb9ca128655f2f7859966b7c6d0c50f2ed (patch) | |
| tree | e2ea678a37f8a74d07a86a87351519e2146bc5f9 /src/kitemviews/kitemlistview.cpp | |
| parent | 0397658b81ce371047d9ce6979aa37d8112f1a2c (diff) | |
Details view: Siblings fixes
The siblings should only range within one group.
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index de80819d7..247354419 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -954,6 +954,13 @@ void KItemListView::slotItemsMoved(const KItemRange& itemRange, const QList<int> } } + if (supportsItemExpanding()) { + // The siblings information only gets updated in KItemListView::doLayout() if + // items have been inserted or removed. In the case of just moving the items + // the siblings must be updated manually: + updateSiblingsInformation(firstVisibleMovedIndex, lastVisibleMovedIndex); + } + doLayout(NoAnimation); } @@ -2079,21 +2086,35 @@ void KItemListView::updateSiblingsInformation(int firstIndex, int lastIndex) bool KItemListView::hasSiblingSuccessor(int index) const { + bool hasSuccessor = false; const int parentsCount = m_model->expandedParentsCount(index); - ++index; + int successorIndex = index + 1; + // Search the next sibling const int itemCount = m_model->count(); - while (index < itemCount) { - const int currentParentsCount = m_model->expandedParentsCount(index); + while (successorIndex < itemCount) { + const int currentParentsCount = m_model->expandedParentsCount(successorIndex); if (currentParentsCount == parentsCount) { - return true; + hasSuccessor = true; + break; } else if (currentParentsCount < parentsCount) { - return false; + break; } - ++index; + ++successorIndex; } - return false; + if (m_grouped && hasSuccessor) { + // If the sibling is part of another group, don't mark it as + // successor as the group header is between the sibling connections. + for (int i = index + 1; i <= successorIndex; ++i) { + if (m_layouter->isFirstGroupItem(i)) { + hasSuccessor = false; + break; + } + } + } + + return hasSuccessor; } int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc) |
