diff options
| author | Peter Penz <[email protected]> | 2012-05-28 23:10:20 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-28 23:11:52 +0200 |
| commit | 4e2f3dcffe2c2388e9d2d63e626ee6d03abce953 (patch) | |
| tree | 7249e8bfda0cbec3d913abfdefdf6deb93d9d134 /src/kitemviews | |
| parent | 276100dcecf19b8037d4da37109c1f8fe6d85459 (diff) | |
Implement dropping of items into the Places Panel
Some polishing regarding the icons and group-alignment must still
be done, but at least the basic functionality is back again.
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 8 | ||||
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index ee69c8990..5f4c54606 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1616,6 +1616,11 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha } if (animate) { + if (m_animation->isStarted(widget, KItemListViewAnimation::MovingAnimation)) { + m_animation->start(widget, KItemListViewAnimation::MovingAnimation, newPos); + applyNewPos = false; + } + const bool itemsRemoved = (changedCount < 0); const bool itemsInserted = (changedCount > 0); if (itemsRemoved && (i >= changedIndex + changedCount + 1)) { @@ -2330,7 +2335,8 @@ int KItemListView::showDropIndicator(const QPointF& pos) } } - return -1; + const QRectF firstItemRect = itemRect(firstVisibleIndex()); + return (pos.y() <= firstItemRect.top()) ? 0 : -1; } void KItemListView::hideDropIndicator() diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index de40791da..5723b9aaa 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -634,7 +634,8 @@ private: * Shows a drop-indicator between items dependent on the given * cursor position. The cursor position is relative the the upper left * edge of the view. - * @return Index of the item where the dropping is done. + * @return Index of the item where the dropping is done. An index of -1 + * indicates that the item has been dropped after the last item. */ int showDropIndicator(const QPointF& pos); void hideDropIndicator(); |
