2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include "klistview.h"
22 #include "klistview_p.h"
24 #include <math.h> // trunc
26 #include <QApplication>
29 #include <QPaintEvent>
34 #include "kitemcategorizer.h"
35 #include "ksortfilterproxymodel.h"
46 inline LessThan(const KSortFilterProxyModel
*proxyModel
,
48 : proxyModel(proxyModel
)
53 inline bool operator()(const QModelIndex
&left
,
54 const QModelIndex
&right
) const
56 if (purpose
== GeneralPurpose
)
58 return proxyModel
->sortOrder() == Qt::AscendingOrder
?
59 proxyModel
->lessThanGeneralPurpose(left
, right
) :
60 !proxyModel
->lessThanGeneralPurpose(left
, right
);
63 return proxyModel
->sortOrder() == Qt::AscendingOrder
?
64 proxyModel
->lessThanCategoryPurpose(left
, right
) :
65 !proxyModel
->lessThanCategoryPurpose(left
, right
);
69 const KSortFilterProxyModel
*proxyModel
;
70 const Purpose purpose
;
74 //==============================================================================
77 KListView::Private::Private(KListView
*listView
)
80 , mouseButtonPressed(false)
82 , lastIndex(QModelIndex())
86 KListView::Private::~Private()
90 const QModelIndexList
&KListView::Private::intersectionSet(const QRect
&rect
)
93 QRect indexVisualRect
;
95 intersectedIndexes
.clear();
97 // Lets find out where we should start
98 int top
= proxyModel
->rowCount() - 1;
100 int middle
= (top
+ bottom
) / 2;
101 while (bottom
<= top
)
103 middle
= (top
+ bottom
) / 2;
105 index
= elementDictionary
[proxyModel
->index(middle
, 0)];
106 indexVisualRect
= visualRect(index
);
108 if (qMax(indexVisualRect
.topLeft().y(),
109 indexVisualRect
.bottomRight().y()) < qMin(rect
.topLeft().y(),
110 rect
.bottomRight().y()))
121 for (int i
= middle
; i
< proxyModel
->rowCount(); i
++)
123 index
= elementDictionary
[proxyModel
->index(i
, 0)];
124 indexVisualRect
= visualRect(index
);
126 if (rect
.intersects(indexVisualRect
))
127 intersectedIndexes
.append(index
);
129 // If we passed next item, stop searching for hits
130 if (qMax(rect
.bottomRight().y(), rect
.topLeft().y()) <
131 indexVisualRect
.topLeft().y())
137 return intersectedIndexes
;
140 QRect
KListView::Private::visualRectInViewport(const QModelIndex
&index
) const
142 if (!index
.isValid())
145 QString curCategory
= elementsInfo
[index
].category
;
147 QRect
retRect(listView
->spacing(), listView
->spacing() * 2 +
148 30 /* categoryHeight */, 0, 0);
150 int viewportWidth
= listView
->viewport()->width() - listView
->spacing();
152 // We really need all items to be of same size. Otherwise we cannot do this
155 // listView->sizeHintForIndex(proxyModel->mapFromSource(index));
156 // int itemHeight = itemSize.height();
157 // int itemWidth = itemSize.width();*/
158 int itemHeight
= 107;
160 int itemWidthPlusSeparation
= listView
->spacing() + itemWidth
;
161 int elementsPerRow
= viewportWidth
/ itemWidthPlusSeparation
;
165 int column
= elementsInfo
[index
].relativeOffsetToCategory
% elementsPerRow
;
166 int row
= elementsInfo
[index
].relativeOffsetToCategory
/ elementsPerRow
;
168 retRect
.setLeft(retRect
.left() + column
* listView
->spacing() +
173 foreach (const QString
&category
, categories
)
175 if (category
== curCategory
)
178 rows
= (float) ((float) categoriesIndexes
[category
].count() /
179 (float) elementsPerRow
);
180 rowsInt
= categoriesIndexes
[category
].count() / elementsPerRow
;
182 if (rows
- trunc(rows
)) rowsInt
++;
184 retRect
.setTop(retRect
.top() +
185 (rowsInt
* listView
->spacing()) +
186 (rowsInt
* itemHeight
) +
187 30 /* categoryHeight */ +
188 listView
->spacing() * 2);
191 retRect
.setTop(retRect
.top() + row
* listView
->spacing() +
194 retRect
.setWidth(itemWidth
);
195 retRect
.setHeight(itemHeight
);
200 QRect
KListView::Private::visualCategoryRectInViewport(const QString
&category
)
203 QRect
retRect(listView
->spacing(),
205 listView
->viewport()->width() - listView
->spacing() * 2,
208 if (!proxyModel
->rowCount() || !categories
.contains(category
))
211 QModelIndex index
= proxyModel
->index(0, 0, QModelIndex());
213 int viewportWidth
= listView
->viewport()->width() - listView
->spacing();
215 // We really need all items to be of same size. Otherwise we cannot do this
217 // QSize itemSize = listView->sizeHintForIndex(index);
218 // int itemHeight = itemSize.height();
219 // int itemWidth = itemSize.width();
220 int itemHeight
= 107;
222 int itemWidthPlusSeparation
= listView
->spacing() + itemWidth
;
223 int elementsPerRow
= viewportWidth
/ itemWidthPlusSeparation
;
230 foreach (const QString
&itCategory
, categories
)
232 if (itCategory
== category
)
235 rows
= (float) ((float) categoriesIndexes
[itCategory
].count() /
236 (float) elementsPerRow
);
237 rowsInt
= categoriesIndexes
[itCategory
].count() / elementsPerRow
;
239 if (rows
- trunc(rows
)) rowsInt
++;
241 retRect
.setTop(retRect
.top() +
242 (rowsInt
* listView
->spacing()) +
243 (rowsInt
* itemHeight
) +
244 30 /* categoryHeight */ +
245 listView
->spacing() * 2);
248 retRect
.setHeight(30 /* categoryHeight */);
253 // We're sure elementsPosition doesn't contain index
254 const QRect
&KListView::Private::cacheIndex(const QModelIndex
&index
)
256 QRect rect
= visualRectInViewport(index
);
257 elementsPosition
[index
] = rect
;
259 return elementsPosition
[index
];
262 // We're sure categoriesPosition doesn't contain category
263 const QRect
&KListView::Private::cacheCategory(const QString
&category
)
265 QRect rect
= visualCategoryRectInViewport(category
);
266 categoriesPosition
[category
] = rect
;
268 return categoriesPosition
[category
];
271 const QRect
&KListView::Private::cachedRectIndex(const QModelIndex
&index
)
273 if (elementsPosition
.contains(index
)) // If we have it cached
275 return elementsPosition
[index
];
277 else // Otherwise, cache it
279 return cacheIndex(index
);
283 const QRect
&KListView::Private::cachedRectCategory(const QString
&category
)
285 if (categoriesPosition
.contains(category
)) // If we have it cached
287 return categoriesPosition
[category
];
289 else // Otherwise, cache it and
291 return cacheCategory(category
);
295 QRect
KListView::Private::visualRect(const QModelIndex
&index
)
297 QModelIndex mappedIndex
= proxyModel
->mapToSource(index
);
299 QRect retRect
= cachedRectIndex(mappedIndex
);
300 int dx
= -listView
->horizontalOffset();
301 int dy
= -listView
->verticalOffset();
302 retRect
.adjust(dx
, dy
, dx
, dy
);
307 QRect
KListView::Private::categoryVisualRect(const QString
&category
)
309 QRect retRect
= cachedRectCategory(category
);
310 int dx
= -listView
->horizontalOffset();
311 int dy
= -listView
->verticalOffset();
312 retRect
.adjust(dx
, dy
, dx
, dy
);
317 void KListView::Private::drawNewCategory(const QString
&category
,
318 const QStyleOption
&option
,
321 QColor color
= option
.palette
.color(QPalette::Text
);
324 painter
->setRenderHint(QPainter::Antialiasing
);
326 QStyleOptionButton opt
;
328 opt
.rect
= option
.rect
;
329 opt
.palette
= option
.palette
;
330 opt
.direction
= option
.direction
;
333 if (option
.rect
.contains(listView
->viewport()->mapFromGlobal(QCursor::pos())) &&
336 const QPalette::ColorGroup group
=
337 option
.state
& QStyle::State_Enabled
?
338 QPalette::Normal
: QPalette::Disabled
;
340 QLinearGradient
gradient(option
.rect
.topLeft(),
341 option
.rect
.bottomRight());
342 gradient
.setColorAt(0,
343 option
.palette
.color(group
,
344 QPalette::Highlight
).light());
345 gradient
.setColorAt(1, Qt::transparent
);
347 painter
->fillRect(option
.rect
, gradient
);
350 /*if (const KStyle *style = dynamic_cast<const KStyle*>(QApplication::style()))
352 style->drawControl(KStyle::CE_Category, &opt, painter, this);
356 QFont painterFont
= painter
->font();
357 painterFont
.setWeight(QFont::Bold
);
358 QFontMetrics
metrics(painterFont
);
359 painter
->setFont(painterFont
);
362 path
.addRect(option
.rect
.left(),
363 option
.rect
.bottom() - 2,
367 QLinearGradient
gradient(option
.rect
.topLeft(),
368 option
.rect
.bottomRight());
369 gradient
.setColorAt(0, color
);
370 gradient
.setColorAt(1, Qt::transparent
);
372 painter
->setBrush(gradient
);
373 painter
->fillPath(path
, gradient
);
375 painter
->setPen(color
);
377 painter
->drawText(option
.rect
, Qt::AlignVCenter
| Qt::AlignLeft
,
378 metrics
.elidedText(category
, Qt::ElideRight
, option
.rect
.width()));
384 void KListView::Private::updateScrollbars()
386 int lastItemBottom
= cachedRectIndex(lastIndex
).bottom() +
387 listView
->spacing() - listView
->viewport()->height();
388 listView
->verticalScrollBar()->setRange(0, lastItemBottom
);
392 //==============================================================================
395 KListView::KListView(QWidget
*parent
)
397 , d(new Private(this))
401 KListView::~KListView()
406 void KListView::setModel(QAbstractItemModel
*model
)
410 QObject::disconnect(d
->proxyModel
,
411 SIGNAL(rowsRemoved(QModelIndex
,int,int)),
412 this, SLOT(rowsRemoved(QModelIndex
,int,int)));
414 QObject::disconnect(d
->proxyModel
,
415 SIGNAL(sortingRoleChanged()),
416 this, SLOT(slotSortingRoleChanged()));
419 QListView::setModel(model
);
421 d
->proxyModel
= dynamic_cast<KSortFilterProxyModel
*>(model
);
425 QObject::connect(d
->proxyModel
,
426 SIGNAL(rowsRemoved(QModelIndex
,int,int)),
427 this, SLOT(rowsRemoved(QModelIndex
,int,int)));
429 QObject::connect(d
->proxyModel
,
430 SIGNAL(sortingRoleChanged()),
431 this, SLOT(slotSortingRoleChanged()));
435 QRect
KListView::visualRect(const QModelIndex
&index
) const
437 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
440 return QListView::visualRect(index
);
443 if (!qobject_cast
<const QSortFilterProxyModel
*>(index
.model()))
445 return d
->visualRect(d
->proxyModel
->mapFromSource(index
));
448 return d
->visualRect(index
);
451 KItemCategorizer
*KListView::itemCategorizer() const
453 return d
->itemCategorizer
;
456 void KListView::setItemCategorizer(KItemCategorizer
*itemCategorizer
)
458 if (!itemCategorizer
&& d
->proxyModel
)
460 QObject::disconnect(d
->proxyModel
,
461 SIGNAL(rowsRemoved(QModelIndex
,int,int)),
462 this, SLOT(rowsRemoved(QModelIndex
,int,int)));
464 QObject::disconnect(d
->proxyModel
,
465 SIGNAL(sortingRoleChanged()),
466 this, SLOT(slotSortingRoleChanged()));
468 else if (itemCategorizer
&& d
->proxyModel
)
470 QObject::connect(d
->proxyModel
,
471 SIGNAL(rowsRemoved(QModelIndex
,int,int)),
472 this, SLOT(rowsRemoved(QModelIndex
,int,int)));
474 QObject::connect(d
->proxyModel
,
475 SIGNAL(sortingRoleChanged()),
476 this, SLOT(slotSortingRoleChanged()));
479 d
->itemCategorizer
= itemCategorizer
;
483 rowsInserted(QModelIndex(), 0, d
->proxyModel
->rowCount() - 1);
487 QModelIndex
KListView::indexAt(const QPoint
&point
) const
489 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
492 return QListView::indexAt(point
);
497 QModelIndexList item
= d
->intersectionSet(QRect(point
, point
));
499 if (item
.count() == 1)
509 void KListView::reset()
513 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
519 d
->elementsInfo
.clear();
520 d
->elementsPosition
.clear();
521 d
->elementDictionary
.clear();
522 d
->categoriesIndexes
.clear();
523 d
->categoriesPosition
.clear();
524 d
->categories
.clear();
525 d
->intersectedIndexes
.clear();
526 d
->sourceModelIndexList
.clear();
527 d
->hovered
= QModelIndex();
528 d
->mouseButtonPressed
= false;
531 void KListView::paintEvent(QPaintEvent
*event
)
533 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
536 QListView::paintEvent(event
);
540 QStyleOptionViewItemV3 option
= viewOptions();
541 QPainter
painter(viewport());
542 QRect area
= event
->rect();
543 const bool focus
= (hasFocus() || viewport()->hasFocus()) &&
544 currentIndex().isValid();
545 const QStyle::State state
= option
.state
;
546 const bool enabled
= (state
& QStyle::State_Enabled
) != 0;
550 QModelIndexList dirtyIndexes
= d
->intersectionSet(area
);
551 foreach (const QModelIndex
&index
, dirtyIndexes
)
553 option
.state
= state
;
554 option
.rect
= d
->visualRect(index
);
556 if (selectionModel() && selectionModel()->isSelected(index
))
558 option
.state
|= QStyle::State_Selected
;
563 QPalette::ColorGroup cg
;
564 if ((d
->proxyModel
->flags(index
) & Qt::ItemIsEnabled
) == 0)
566 option
.state
&= ~QStyle::State_Enabled
;
567 cg
= QPalette::Disabled
;
571 cg
= QPalette::Normal
;
573 option
.palette
.setCurrentColorGroup(cg
);
576 if (focus
&& currentIndex() == index
)
578 option
.state
|= QStyle::State_HasFocus
;
579 if (this->state() == EditingState
)
580 option
.state
|= QStyle::State_Editing
;
583 if ((index
== d
->hovered
) && !d
->mouseButtonPressed
)
584 option
.state
|= QStyle::State_MouseOver
;
586 option
.state
&= ~QStyle::State_MouseOver
;
588 itemDelegate(index
)->paint(&painter
, option
, index
);
592 QStyleOptionViewItem otherOption
;
593 foreach (const QString
&category
, d
->categories
)
595 otherOption
= option
;
596 otherOption
.rect
= d
->categoryVisualRect(category
);
598 if (otherOption
.rect
.intersects(area
))
600 d
->drawNewCategory(category
, otherOption
, &painter
);
604 if (d
->mouseButtonPressed
)
606 QPoint start
, end
, initialPressPosition
;
608 initialPressPosition
= d
->initialPressPosition
;
610 initialPressPosition
.setY(initialPressPosition
.y() - verticalOffset());
611 initialPressPosition
.setX(initialPressPosition
.x() - horizontalOffset());
613 if (d
->initialPressPosition
.x() > d
->mousePosition
.x() ||
614 d
->initialPressPosition
.y() > d
->mousePosition
.y())
616 start
= d
->mousePosition
;
617 end
= initialPressPosition
;
621 start
= initialPressPosition
;
622 end
= d
->mousePosition
;
625 QStyleOptionRubberBand yetAnotherOption
;
626 yetAnotherOption
.initFrom(this);
627 yetAnotherOption
.shape
= QRubberBand::Rectangle
;
628 yetAnotherOption
.opaque
= false;
629 yetAnotherOption
.rect
= QRect(start
, end
).intersected(viewport()->rect().adjusted(-16, -16, 16, 16));
631 style()->drawControl(QStyle::CE_RubberBand
, &yetAnotherOption
, &painter
);
638 void KListView::resizeEvent(QResizeEvent
*event
)
640 QListView::resizeEvent(event
);
642 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
648 // Clear the items positions cache
649 d
->elementsPosition
.clear();
650 d
->categoriesPosition
.clear();
652 d
->updateScrollbars();
655 void KListView::setSelection(const QRect
&rect
,
656 QItemSelectionModel::SelectionFlags flags
)
658 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
661 QListView::setSelection(rect
, flags
);
665 // FIXME: I have to rethink and rewrite this method (ereslibre)
667 QModelIndexList dirtyIndexes
= d
->intersectionSet(rect
);
668 foreach (const QModelIndex
&index
, dirtyIndexes
)
670 if (!d
->mouseButtonPressed
&& rect
.intersects(visualRect(index
)))
672 selectionModel()->select(index
, flags
);
676 selectionModel()->select(index
, QItemSelectionModel::Select
);
678 if (d
->mouseButtonPressed
)
679 d
->tempSelected
.append(index
);
683 if (d
->mouseButtonPressed
)
685 foreach (const QModelIndex
&index
, selectionModel()->selectedIndexes())
687 if (!rect
.intersects(visualRect(index
)))
689 selectionModel()->select(index
, QItemSelectionModel::Deselect
);
691 if (d
->mouseButtonPressed
)
693 d
->tempSelected
.removeAll(index
);
700 void KListView::mouseMoveEvent(QMouseEvent
*event
)
702 QListView::mouseMoveEvent(event
);
704 d
->mousePosition
= event
->pos();
706 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
714 viewport()->update();
717 void KListView::mousePressEvent(QMouseEvent
*event
)
719 QListView::mousePressEvent(event
);
721 d
->tempSelected
.clear();
723 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
731 if (event
->button() == Qt::LeftButton
)
733 d
->mouseButtonPressed
= true;
735 d
->initialPressPosition
= event
->pos();
736 d
->initialPressPosition
.setY(d
->initialPressPosition
.y() +
738 d
->initialPressPosition
.setX(d
->initialPressPosition
.x() +
742 viewport()->update();
745 void KListView::mouseReleaseEvent(QMouseEvent
*event
)
747 QListView::mouseReleaseEvent(event
);
749 d
->mouseButtonPressed
= false;
751 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
759 // FIXME: I have to rethink and rewrite this method (ereslibre)
761 QPoint initialPressPosition
= viewport()->mapFromGlobal(QCursor::pos());
762 initialPressPosition
.setY(initialPressPosition
.y() + verticalOffset());
763 initialPressPosition
.setX(initialPressPosition
.x() + horizontalOffset());
765 if (initialPressPosition
== d
->initialPressPosition
)
767 foreach(const QString
&category
, d
->categories
)
769 if (d
->categoryVisualRect(category
).contains(event
->pos()))
772 QItemSelectionModel::SelectionFlag flag
;
773 foreach (const QModelIndex
&mappedIndex
,
774 d
->categoriesIndexes
[category
])
776 index
= d
->proxyModel
->mapFromSource(mappedIndex
);
778 if (selectionModel()->selectedIndexes().contains(index
))
780 flag
= QItemSelectionModel::Deselect
;
784 flag
= QItemSelectionModel::Select
;
787 selectionModel()->select(index
, flag
);
793 viewport()->update();
796 void KListView::leaveEvent(QEvent
*event
)
798 QListView::leaveEvent(event
);
800 d
->hovered
= QModelIndex();
802 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
810 viewport()->update();
813 void KListView::rowsInserted(const QModelIndex
&parent
,
817 QListView::rowsInserted(parent
, start
, end
);
819 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
825 rowsInsertedArtifficial(parent
, start
, end
);
828 void KListView::rowsInsertedArtifficial(const QModelIndex
&parent
,
832 d
->elementsInfo
.clear();
833 d
->elementsPosition
.clear();
834 d
->elementDictionary
.clear();
835 d
->categoriesIndexes
.clear();
836 d
->categoriesPosition
.clear();
837 d
->categories
.clear();
838 d
->intersectedIndexes
.clear();
839 d
->sourceModelIndexList
.clear();
840 d
->hovered
= QModelIndex();
841 d
->mouseButtonPressed
= false;
843 if (start
> end
|| end
< 0 || start
< 0 || !d
->proxyModel
->rowCount())
848 // Add all elements mapped to the source model
849 for (int i
= 0; i
< d
->proxyModel
->rowCount(); i
++)
851 d
->sourceModelIndexList
<<
852 d
->proxyModel
->mapToSource(d
->proxyModel
->index(i
, 0));
855 // Sort them with the general purpose lessThan method
856 LessThan
generalLessThan(d
->proxyModel
,
857 LessThan::GeneralPurpose
);
859 qStableSort(d
->sourceModelIndexList
.begin(), d
->sourceModelIndexList
.end(),
862 // Explore categories
863 QString prevCategory
=
864 d
->itemCategorizer
->categoryForItem(d
->sourceModelIndexList
[0],
865 d
->proxyModel
->sortRole());
866 QString lastCategory
= prevCategory
;
867 QModelIndexList modelIndexList
;
868 struct Private::ElementInfo elementInfo
;
869 foreach (const QModelIndex
&index
, d
->sourceModelIndexList
)
871 lastCategory
= d
->itemCategorizer
->categoryForItem(index
,
872 d
->proxyModel
->sortRole());
874 elementInfo
.category
= lastCategory
;
876 if (prevCategory
!= lastCategory
)
878 d
->categoriesIndexes
.insert(prevCategory
, modelIndexList
);
879 d
->categories
<< prevCategory
;
880 modelIndexList
.clear();
883 modelIndexList
<< index
;
884 prevCategory
= lastCategory
;
886 d
->elementsInfo
.insert(index
, elementInfo
);
889 d
->categoriesIndexes
.insert(prevCategory
, modelIndexList
);
890 d
->categories
<< prevCategory
;
892 // Sort items locally in their respective categories with the category
894 LessThan
categoryLessThan(d
->proxyModel
,
895 LessThan::CategoryPurpose
);
897 foreach (const QString
&key
, d
->categories
)
899 QModelIndexList
&indexList
= d
->categoriesIndexes
[key
];
901 qStableSort(indexList
.begin(), indexList
.end(), categoryLessThan
);
904 d
->lastIndex
= d
->categoriesIndexes
[d
->categories
[d
->categories
.count() - 1]][d
->categoriesIndexes
[d
->categories
[d
->categories
.count() - 1]].count() - 1];
906 // Finally, fill data information of items situation. This will help when
907 // trying to compute an item place in the viewport
908 int i
= 0; // position relative to the category beginning
909 int j
= 0; // number of elements before current
910 foreach (const QString
&key
, d
->categories
)
912 foreach (const QModelIndex
&index
, d
->categoriesIndexes
[key
])
914 struct Private::ElementInfo
&elementInfo
= d
->elementsInfo
[index
];
916 elementInfo
.relativeOffsetToCategory
= i
;
918 d
->elementDictionary
.insert(d
->proxyModel
->index(j
, 0),
919 d
->proxyModel
->mapFromSource(index
));
928 d
->updateScrollbars();
931 void KListView::rowsRemoved(const QModelIndex
&parent
,
937 // Force the view to update all elements
938 rowsInsertedArtifficial(parent
, start
, end
);
942 void KListView::updateGeometries()
944 if ((viewMode() == KListView::ListMode
) || !d
->proxyModel
||
947 QListView::updateGeometries();
951 // Avoid QListView::updateGeometries(), since it will try to set another
952 // range to our scroll bars, what we don't want (ereslibre)
953 QAbstractItemView::updateGeometries();
956 void KListView::slotSortingRoleChanged()
960 // Force the view to update all elements
961 rowsInsertedArtifficial(QModelIndex(), 0, d
->proxyModel
->rowCount() -
966 #include "klistview.moc"