X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7b6a67e520c04f56b4b05fa26b252177398df6df..781e8e9e18579c0fe368ed9fe295f908493272b3:/src/kitemviews/kitemlistcontroller.h diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 0969ed21a..48da07206 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -24,6 +24,7 @@ class KItemListKeyboardSearchManager; class KItemListSelectionManager; class KItemListView; class KItemListWidget; +class QContextMenuEvent; class QGestureEvent; class QGraphicsSceneHoverEvent; class QGraphicsSceneDragDropEvent; @@ -49,11 +50,8 @@ class QTouchEvent; class DOLPHIN_EXPORT KItemListController : public QObject { Q_OBJECT - Q_PROPERTY(KItemModelBase *model READ model WRITE setModel) - Q_PROPERTY(KItemListView *view READ view WRITE setView) - Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior) - Q_PROPERTY(AutoActivationBehavior autoActivationBehavior READ autoActivationBehavior WRITE setAutoActivationBehavior) - Q_PROPERTY(MouseDoubleClickAction mouseDoubleClickAction READ mouseDoubleClickAction WRITE setMouseDoubleClickAction) + Q_PROPERTY(KItemModelBase *model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(KItemListView *view READ view WRITE setView NOTIFY viewChanged) public: enum SelectionBehavior { NoSelection, SingleSelection, MultiSelection }; @@ -90,23 +88,8 @@ public: int indexCloseToMousePressedPosition() const; - /** - * Sets the delay in milliseconds when dragging an object above an item - * until the item gets activated automatically. A value of -1 indicates - * that no automatic activation will be done at all (= default value). - * - * The hovered item must support dropping (see KItemModelBase::supportsDropping()), - * otherwise the automatic activation is not available. - * - * After activating the item the signal itemActivated() will be - * emitted. If the view supports the expanding of items - * (KItemListView::supportsItemExpanding() returns true) and the item - * itself is expandable (see KItemModelBase::isExpandable()) then instead - * of activating the item it gets expanded instead (see - * KItemModelBase::setExpanded()). - */ - void setAutoActivationDelay(int delay); - int autoActivationDelay() const; + void setAutoActivationEnabled(bool enabled); + bool isAutoActivationEnabled() const; /** * If set to true, the signals itemActivated() and itemsActivated() are emitted @@ -232,6 +215,12 @@ Q_SIGNALS: void decreaseZoom(); void swipeUp(); + /** + * Emitted when the view's background is double-clicked. + * Used to trigger an user configured action. + */ + void doubleClickViewBackground(Qt::MouseButton button); + public Q_SLOTS: void slotStateChanged(QScroller::State newState); @@ -316,6 +305,7 @@ private: bool mouseMoveEvent(QGraphicsSceneMouseEvent *event, const QTransform &transform); bool mouseReleaseEvent(QGraphicsSceneMouseEvent *event, const QTransform &transform); bool mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event, const QTransform &transform); + bool contextMenuEvent(QContextMenuEvent *event); bool dragEnterEvent(QGraphicsSceneDragDropEvent *event, const QTransform &transform); bool dragLeaveEvent(QGraphicsSceneDragDropEvent *event, const QTransform &transform); bool dragMoveEvent(QGraphicsSceneDragDropEvent *event, const QTransform &transform); @@ -332,7 +322,7 @@ private: void pinchTriggered(QGestureEvent *event, const QTransform &transform); void swipeTriggered(QGestureEvent *event, const QTransform &transform); void twoFingerTapTriggered(QGestureEvent *event, const QTransform &transform); - bool onPress(const QPoint &screenPos, const QPointF &pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons); + bool onPress(const QPointF &pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons); bool onRelease(const QPointF &pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons, bool touch); void startRubberBand(); @@ -355,8 +345,9 @@ private: KItemListSelectionManager *m_selectionManager; KItemListKeyboardSearchManager *m_keyboardManager; std::optional m_pressedIndex; - QPointF m_pressedMousePos; + QPointF m_pressedMouseGlobalPos; + bool m_autoActivationEnabled = false; QTimer *m_autoActivationTimer; Qt::GestureType m_swipeGesture;