Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kitemlistselectionmanager.h
Show All 33 Lines | |||||
34 | 34 | | |||
35 | /** | 35 | /** | ||
36 | * @brief Allows to select and deselect items of a KItemListView. | 36 | * @brief Allows to select and deselect items of a KItemListView. | ||
37 | */ | 37 | */ | ||
38 | class DOLPHIN_EXPORT KItemListSelectionManager : public QObject | 38 | class DOLPHIN_EXPORT KItemListSelectionManager : public QObject | ||
39 | { | 39 | { | ||
40 | Q_OBJECT | 40 | Q_OBJECT | ||
41 | 41 | | |||
42 | enum RangesRemovingBehaviour { | 42 | enum class RangesRemovingBehaviour { | ||
43 | DiscardRemovedIndex, | 43 | DiscardRemovedIndex, | ||
44 | AdjustRemovedIndex | 44 | AdjustRemovedIndex | ||
45 | }; | 45 | }; | ||
46 | 46 | | |||
47 | public: | 47 | public: | ||
48 | enum SelectionMode { | 48 | enum class SelectionMode { | ||
49 | Select, | 49 | Select, | ||
50 | Deselect, | 50 | Deselect, | ||
51 | Toggle | 51 | Toggle | ||
52 | }; | 52 | }; | ||
53 | 53 | | |||
54 | explicit KItemListSelectionManager(QObject* parent = nullptr); | 54 | explicit KItemListSelectionManager(QObject* parent = nullptr); | ||
55 | ~KItemListSelectionManager() override; | 55 | ~KItemListSelectionManager() override; | ||
56 | 56 | | |||
57 | void setCurrentItem(int current); | 57 | void setCurrentItem(int current); | ||
58 | int currentItem() const; | 58 | int currentItem() const; | ||
59 | 59 | | |||
60 | void setSelectedItems(const KItemSet& items); | 60 | void setSelectedItems(const KItemSet& items); | ||
61 | KItemSet selectedItems() const; | 61 | KItemSet selectedItems() const; | ||
62 | bool isSelected(int index) const; | 62 | bool isSelected(int index) const; | ||
63 | bool hasSelection() const; | 63 | bool hasSelection() const; | ||
64 | 64 | | |||
65 | void setSelected(int index, int count = 1, SelectionMode mode = Select); | 65 | void setSelected(int index, int count = 1, SelectionMode mode = SelectionMode::Select); | ||
66 | void clearSelection(); | 66 | void clearSelection(); | ||
67 | 67 | | |||
68 | void beginAnchoredSelection(int anchor); | 68 | void beginAnchoredSelection(int anchor); | ||
69 | void endAnchoredSelection(); | 69 | void endAnchoredSelection(); | ||
70 | bool isAnchoredSelectionActive() const; | 70 | bool isAnchoredSelectionActive() const; | ||
71 | 71 | | |||
72 | KItemModelBase* model() const; | 72 | KItemModelBase* model() const; | ||
73 | 73 | | |||
Show All 31 Lines |