diff options
| author | Frank Reininghaus <[email protected]> | 2011-09-29 20:50:00 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2011-09-29 20:50:00 +0200 |
| commit | 7424fcc3314a63d0716cb428a8b8de24b23e0279 (patch) | |
| tree | 3c51a6b755fa6eb27806e947dde63d93739b48d8 /src/kitemviews/kitemmodelbase.h | |
| parent | e43f29576d4666a66cd4d236418baf403f176069 (diff) | |
Keep current item and selection when resorting, part 1
KFileItemModel now emits the itemsMoved signal when the model
is resorted, and KItemListSelectionManager has a new function
itemsMoved() which will be called indirectly when this signal
is emitted. Unit tests for the new functionality are included.
The following things are still needed to make the feature
work:
1. KFileItemMdel::resortAllItems() should not emit
itemsAdded/itemsRemoved any more.
2. KItemListView::itemsMoved() must update the view according
to the changes in the model, and it must call
KItemListSelectionManager::itemsMoved().
Diffstat (limited to 'src/kitemviews/kitemmodelbase.h')
| -rw-r--r-- | src/kitemviews/kitemmodelbase.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index 742bc2915..763a02efd 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -34,7 +34,7 @@ class QMimeData; struct KItemRange { - KItemRange(int index, int count); + KItemRange(int index = 0, int count = 0); int index; int count; @@ -180,20 +180,15 @@ signals: /** * Is emitted if one ore more items get moved. - * @param itemRanges Item-ranges that get moved to a new position. - * @param movedToIndexes New positions for each element of the item-ranges. + * @param itemRange Item-range that gets moved to a new position. + * @param movedToIndexes New positions for each element of the item-range. * * For example if the model has 10 items and the items 0 and 1 get exchanged * with the items 5 and 6 then the parameters look like this: - * - itemRanges: Contains two ranges. The first has the index 0 and a count of - * 2 and the second as the index 5 and a count of 2. - * - movedToIndexes: Contains the four values 5, 6, 0, 1 - * - * For the item-ranges it is assured that: - * - They don't overlap - * - The index of item-range n is smaller than the index of item-range n + 1. + * - itemRange: has the index 0 and a count of 7. + * - movedToIndexes: Contains the seven values 5, 6, 2, 3, 4, 0, 1 */ - void itemsMoved(const KItemRangeList& itemRanges, const QList<int> movedToIndexes); + void itemsMoved(const KItemRange& itemRange, const QList<int>& movedToIndexes); void itemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles); |
