diff options
| author | Felix Ernst <[email protected]> | 2021-09-12 15:33:39 +0200 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2022-08-14 14:42:40 +0000 |
| commit | 3b7c05b385dc56fbc0b9ffdd332f8d30e7624d0c (patch) | |
| tree | a54c8338e3dc7d420fd2223bbcfb5af0a186348e /src/kitemviews/kitemlistcontroller.h | |
| parent | 9dbe48137748c6197363236b67f6302e20b72167 (diff) | |
Add Selection Mode
The selection mode action is a checkable toggle action named
"Select Files and Folders" which has "Space" as the default
shortcut.
In selection mode a bottom bar with contextual actions is shown.
These should mostly mirror the actions which are available through
the right-click context menu aka DolphinContextMenu.
Resizing of the window might make a overflow button appear in the
bottom selection mode bar.
This commit makes press and hold in the view activate selection
mode. This behaviour is not triggered if the press and hold is
used to either start a rubberband selection or a drag operation
within a short time. The length of the short timeframe is defined
by a QStyleHint. This is currently not implemented in touch
because I can't test it.
Mix the selection mode bars' background colors using a nice
combination of colors from the current color scheme
BUG: 427202
Diffstat (limited to 'src/kitemviews/kitemlistcontroller.h')
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index d2e56eb64..a3d952de5 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -126,6 +126,9 @@ public: void setSingleClickActivationEnforced(bool singleClick); bool singleClickActivationEnforced() const; + void setSelectionMode(bool enabled); + bool selectionMode() const; + bool processEvent(QEvent* event, const QTransform& transform); Q_SIGNALS: @@ -209,6 +212,14 @@ Q_SIGNALS: */ void escapePressed(); + /** + * Is emitted if left click is pressed down for a long time without moving the cursor too much. + * Moving the cursor would either trigger an item drag if the click was initiated on top of an item + * or a selection rectangle if the click was not initiated on top of an item. + * So long press is only emitted if there wasn't a lot of cursor movement. + */ + void selectionModeRequested(); + void modelChanged(KItemModelBase* current, KItemModelBase* previous); void viewChanged(KItemListView* current, KItemListView* previous); @@ -325,6 +336,7 @@ private: private: bool m_singleClickActivationEnforced; + bool m_selectionMode; bool m_selectionTogglePressed; bool m_clearSelectionIfItemsAreNotDragged; bool m_isSwipeGesture; @@ -344,6 +356,7 @@ private: QPointF m_pressedMousePos; QTimer* m_autoActivationTimer; + QTimer* m_longPressDetectionTimer; Qt::GestureType m_swipeGesture; Qt::GestureType m_twoFingerTapGesture; |
