The siblings should only range within one group.
+ 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);
+ }
+
bool KItemListView::hasSiblingSuccessor(int index) const
{
bool KItemListView::hasSiblingSuccessor(int index) const
{
+ bool hasSuccessor = false;
const int parentsCount = m_model->expandedParentsCount(index);
const int parentsCount = m_model->expandedParentsCount(index);
+ int successorIndex = index + 1;
+ // Search the next sibling
const int itemCount = m_model->count();
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) {
if (currentParentsCount == parentsCount) {
+ hasSuccessor = true;
+ break;
} else if (currentParentsCount < parentsCount) {
} else if (currentParentsCount < parentsCount) {
+ 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)
}
int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc)
- painter->setRenderHint(QPainter::Antialiasing);
-
if (m_alternatingBackgroundColors && (m_index & 0x1)) {
const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
const QRectF backgroundRect(0, 0, size().width(), size().height());
if (m_alternatingBackgroundColors && (m_index & 0x1)) {
const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
const QRectF backgroundRect(0, 0, size().width(), size().height());