From e9d29bcf30ccbd7c76ba37ce9efcfac1649fc46e Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 18 May 2012 23:21:49 +0200 Subject: Enable basic drag and drop support for the Places Panel The dropping has not been implemented yet, however in the context of this step the creating of the drag-pixmap is now forwarded to the item-widgets. This allows creating some optimized dragging-pixmaps e.g. for the details-view, where only the name and icon should be provided as drag-pixmap. --- src/kitemviews/kitemlistview.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/kitemviews/kitemlistview.cpp') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 0f31cb5a1..ebcf48680 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -566,8 +567,21 @@ KItemListHeader* KItemListView::header() const QPixmap KItemListView::createDragPixmap(const QSet& 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) -- cgit v1.3