X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f65b0899c3666561cafac14f67ab0bb8a5bfa00a..cebcf8db:/src/kitemviews/private/kitemlistsmoothscroller.h diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index 55548219e..32effa3d6 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -25,17 +25,16 @@ class DOLPHIN_EXPORT KItemListSmoothScroller : public QObject Q_OBJECT public: - explicit KItemListSmoothScroller(QScrollBar* scrollBar, - QObject* parent = nullptr); + explicit KItemListSmoothScroller(QScrollBar *scrollBar, QObject *parent = nullptr); ~KItemListSmoothScroller() override; - void setScrollBar(QScrollBar* scrollBar); - QScrollBar* scrollBar() const; + void setScrollBar(QScrollBar *scrollBar); + QScrollBar *scrollBar() const; - void setTargetObject(QObject* target); - QObject* targetObject() const; + void setTargetObject(QObject *target); + QObject *targetObject() const; - void setPropertyName(const QByteArray& propertyName); + void setPropertyName(const QByteArray &propertyName); QByteArray propertyName() const; /** @@ -67,22 +66,32 @@ public: /** * Forwards wheel events to the scrollbar, ensuring smooth and proper scrolling */ - void handleWheelEvent(QWheelEvent* event); + void handleWheelEvent(QWheelEvent *event); + +Q_SIGNALS: + /** + * Emitted when the scrolling animation has finished + */ + void scrollingStopped(); protected: - bool eventFilter(QObject* obj, QEvent* event) override; + bool eventFilter(QObject *obj, QEvent *event) override; private Q_SLOTS: - void slotAnimationStateChanged(QAbstractAnimation::State newState, - QAbstractAnimation::State oldState); + void slotAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + /** + * Calculates the duration of the smooth scrolling animation. + * If \p isSmoothScrollingEnabled is true, the duration will be calculated + * using the widget animation duration from the current style. Otherwise, + * the animation will be instantaneous. + */ + void updateAnimationDuration(bool isSmoothScrollingEnabled); private: bool m_scrollBarPressed; bool m_smoothScrolling; - QScrollBar* m_scrollBar; - QPropertyAnimation* m_animation; + QScrollBar *m_scrollBar; + QPropertyAnimation *m_animation; }; #endif - -