diff options
| author | Peter Penz <[email protected]> | 2012-05-26 13:40:48 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-26 13:41:30 +0200 |
| commit | 073f8cae13f2637c0bf2f5611295e103418d52ff (patch) | |
| tree | 08eadfa6f69f036a04945b2c6e512bfb8207e018 /src/kitemviews/kitemlistview.cpp | |
| parent | f7622d323926017b9acc4d42f05abdc4bd5ca456 (diff) | |
Further preperations for drag & drop support in the places panel
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 1586c9d96..ee69c8990 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -2313,15 +2313,20 @@ int KItemListView::showDropIndicator(const QPointF& pos) const QPointF mappedPos = widget->mapFromItem(this, pos); const QRectF rect = itemRect(widget->index()); if (mappedPos.y() >= 0 && mappedPos.y() <= rect.height()) { - const qreal y = (mappedPos.y () < rect.height() / 2) ? - rect.top() : rect.bottom(); + const bool isAboveItem = (mappedPos.y () < rect.height() / 2); + const qreal y = isAboveItem ? rect.top() : rect.bottom(); const QRectF draggingInsertIndicator(rect.left(), y, rect.width(), 1); if (m_dropIndicator != draggingInsertIndicator) { m_dropIndicator = draggingInsertIndicator; update(); } - return widget->index(); + + int index = widget->index(); + if (!isAboveItem) { + ++index; + } + return index; } } |
