#include <QCursor>
#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsView>
#include <QPainter>
#include <QPropertyAnimation>
#include <QStyle>
QPixmap KItemListView::createDragPixmap(const QSet<int>& indexes) const
{
- Q_UNUSED(indexes);
- return QPixmap();
+ QPixmap pixmap;
+
+ if (indexes.count() == 1) {
+ KItemListWidget* item = m_visibleItems.value(indexes.toList().first());
+ QGraphicsView* graphicsView = scene()->views()[0];
+ if (item && graphicsView) {
+ pixmap = item->createDragPixmap(0, graphicsView);
+ }
+ } else {
+ // TODO: Not implemented yet. Probably extend the interface
+ // from KItemListWidget::createDragPixmap() to return a pixmap
+ // that can be used for multiple indexes.
+ }
+
+ return pixmap;
}
void KItemListView::editRole(int index, const QByteArray& role)
}
}
- // In case if items of the same group have been inserted before an item that
- // currently represents the first item of the group, the group header of
- // this item must be removed.
- if (m_grouped && index + count < m_model->count()) {
- updateGroupHeaderForWidget(m_visibleItems.value(index + count));
- }
-
if (m_model->count() == count && m_activeTransactions == 0) {
// Check whether a scrollbar is required to show the inserted items. In this case
// the size of the layouter will be decreased before calling doLayout(): This prevents
#endif
m_endTransactionAnimationHint = NoAnimation;
endTransaction();
+
updateSiblingsInformation();
}
+ if (m_grouped && (hasMultipleRanges || itemRanges.first().count < m_model->count())) {
+ // In case if items of the same group have been inserted before an item that
+ // currently represents the first item of the group, the group header of
+ // this item must be removed.
+ updateVisibleGroupHeaders();
+ }
+
if (useAlternateBackgrounds()) {
updateAlternateBackgrounds();
}
}
}
- // In case if the first item of a group has been removed, the group header
- // must be applied to the next visible item.
- if (m_grouped && index < m_model->count()) {
- updateGroupHeaderForWidget(m_visibleItems.value(index));
- }
-
if (!hasMultipleRanges) {
// The decrease-layout-size optimization in KItemListView::slotItemsInserted()
// assumes an updated geometry. If items are removed during an active transaction,
updateSiblingsInformation();
}
+ if (m_grouped && (hasMultipleRanges || m_model->count() > 0)) {
+ // In case if the first item of a group has been removed, the group header
+ // must be applied to the next visible item.
+ updateVisibleGroupHeaders();
+ }
+
if (useAlternateBackgrounds()) {
updateAlternateBackgrounds();
}