diff options
| author | Peter Penz <[email protected]> | 2011-08-27 20:12:03 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-08-27 20:13:22 +0200 |
| commit | d99d5fbea76a79346761c0d8ce98a0719e5790d2 (patch) | |
| tree | 50b944a3adf3e4533003d91df16f3b19bb636412 /src/kitemviews/kitemlistview.h | |
| parent | 4905667ada4ddd0aee3d2bb077e401a4262804b9 (diff) | |
Improve the autoscrolling for the rubberband selection
This modifications will also allow to do an autoscrolling in an
easy way for drag and drop operations (not fully implemented yet).
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 344221e40..9977e3639 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -90,6 +90,14 @@ public: QHash<QByteArray, int> visibleRoles() const; /** + * If set to true an automatic scrolling is done as soon as the + * mouse is moved near the borders of the view. Per default + * the automatic scrolling is turned off. + */ + void setAutoScroll(bool enabled); + bool autoScroll() const; + + /** * @return Controller of the item-list. The controller gets * initialized by KItemListController::setView() and will * result in calling KItemListController::onControllerChanged(). @@ -124,6 +132,7 @@ public: void setStyleOption(const KItemListStyleOption& option); const KItemListStyleOption& styleOption() const; + /** @reimp */ virtual void setGeometry(const QRectF& rect); int itemAt(const QPointF& pos) const; @@ -207,13 +216,13 @@ private slots: KItemListViewAnimation::AnimationType type); void slotLayoutTimerFinished(); - void slotRubberBandStartPosChanged(); - void slotRubberBandEndPosChanged(); + void slotRubberBandPosChanged(); void slotRubberBandActivationChanged(bool active); /** - * Emits the signal scrollTo() with the corresponding target offset if the current - * mouse position is above the autoscroll-margin. + * Triggers the autoscrolling if autoScroll() is enabled by checking the + * current mouse position. If the mouse position is within the autoscroll + * margins a timer will be started that periodically triggers the autoscrolling. */ void triggerAutoScrolling(); @@ -289,7 +298,6 @@ private: static int calculateAutoScrollingIncrement(int pos, int size); private: - bool m_autoScrollMarginEnabled; bool m_grouped; int m_activeTransactions; // Counter for beginTransaction()/endTransaction() @@ -314,9 +322,11 @@ private: qreal m_oldOffset; qreal m_oldMaximumOffset; + bool m_skipAutoScrollForRubberBand; KItemListRubberBand* m_rubberBand; QPointF m_mousePos; + QTimer* m_autoScrollTimer; friend class KItemListController; }; |
