diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-13 16:08:12 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-14 15:05:55 (GMT) |
commit | c6f1e91c114eaf331fd40c909553b173136ffe99 (patch) | |
tree | 060d05df8ea49d59b15a3afa7504616b2c7fa3d2 /src/gui/itemviews/qlistview.cpp | |
parent | 5baf1a9ba0388109685539384d6f4e674ad252d6 (diff) | |
download | Qt-c6f1e91c114eaf331fd40c909553b173136ffe99.zip Qt-c6f1e91c114eaf331fd40c909553b173136ffe99.tar.gz Qt-c6f1e91c114eaf331fd40c909553b173136ffe99.tar.bz2 |
QListView in icon view mode, drop enabled items wouldn't receive anything
QIconModeViewBase::filterDropEvent() was only moving the items around in the
view without ever checking whether the cursor was over a drop enabled
item. Now it does and returns false if it's the case. As a consequence,
QAbstractItemView::dropEvent() gets called. No auto-test since it's a drag &
drop related task.
Reviewed-by: janarve
Task-number: QTBUG-6848
Diffstat (limited to 'src/gui/itemviews/qlistview.cpp')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index f289c7d..19b1e8c 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2621,6 +2621,13 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e) const QSize contents = contentsSize; QPoint offset(horizontalOffset(), verticalOffset()); QPoint end = e->pos() + offset; + if (qq->acceptDrops()) { + const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled; + const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1))); + foreach (const QModelIndex &index, dropIndices) + if ((index.flags() & dropableFlags) == dropableFlags) + return false; + } QPoint start = dd->pressedPosition; QPoint delta = (dd->movement == QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start); QList<QModelIndex> indexes = dd->selectionModel->selectedIndexes(); |