diff options
| author | Peter Penz <[email protected]> | 2011-09-01 23:08:22 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-01 23:09:31 +0200 |
| commit | d2a3510cc372685ad491a0b653587bf569a132aa (patch) | |
| tree | b9fbb099eb8e364df6e61d856c1861a35ebff036 /src/kitemviews/kitemlistview.h | |
| parent | c4a3313ea918e75ba25e94804f73a32cf5bf2e94 (diff) | |
Improve autoscrolling
- Start autoscrolling when doing a dragging
- Start autoscrolling with a small delay
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 9977e3639..55a5c3344 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -200,6 +200,9 @@ protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event); virtual void dragEnterEvent(QGraphicsSceneDragDropEvent* event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent* event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent* event); + virtual void dropEvent(QGraphicsSceneDragDropEvent* event); QList<KItemListWidget*> visibleItemListWidgets() const; @@ -290,12 +293,16 @@ private: void updateWidgetProperties(KItemListWidget* widget, int index); /** - * Helper function for triggerAutoScrolling(). Returns the scroll increment - * that should be added to the offset() based on the available size \a size - * and the current mouse position \a pos. As soon as \a pos is inside - * the autoscroll-margin a value != 0 will be returned. + * Helper function for triggerAutoScrolling(). + * @param pos Logical position of the mouse relative to the range. + * @param range Range of the visible area. + * @param oldInc Previous increment. Is used to assure that the increment + * increases only gradually. + * @return Scroll increment that should be added to the offset(). + * As soon as \a pos is inside the autoscroll-margin a + * value != 0 will be returned. */ - static int calculateAutoScrollingIncrement(int pos, int size); + static int calculateAutoScrollingIncrement(int pos, int range, int oldInc); private: bool m_grouped; @@ -326,6 +333,7 @@ private: KItemListRubberBand* m_rubberBand; QPointF m_mousePos; + int m_autoScrollIncrement; QTimer* m_autoScrollTimer; friend class KItemListController; |
