diff options
| author | Peter Penz <[email protected]> | 2012-05-18 23:21:49 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-18 23:31:44 +0200 |
| commit | e9d29bcf30ccbd7c76ba37ce9efcfac1649fc46e (patch) | |
| tree | 954ea3c1e8f7204c5e51353f444333496988ae1e /src/kitemviews/kitemlistview.cpp | |
| parent | d9eab08fcb8bfc56470a7f418465607888b5f1ba (diff) | |
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.
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
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 <QCursor> #include <QGraphicsSceneMouseEvent> +#include <QGraphicsView> #include <QPainter> #include <QPropertyAnimation> #include <QStyle> @@ -566,8 +567,21 @@ KItemListHeader* KItemListView::header() const 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) |
