class KItemListGroupHeader;
class KItemListGroupHeaderCreatorBase;
class KItemListSizeHintResolver;
+class KItemListRubberBand;
class KItemListViewAnimation;
class KItemListViewLayouter;
class KItemListWidget;
void endTransaction();
bool isTransactionActive() const;
+ /**
+ * @reimp
+ */
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+
signals:
- void offsetChanged(int current, int previous);
- void maximumOffsetChanged(int current, int previous);
- void scrollTo(int newOffset);
+ void offsetChanged(qreal current, qreal previous);
+ void maximumOffsetChanged(qreal current, qreal previous);
+ void scrollTo(qreal newOffset);
protected:
virtual void initializeItemListWidget(KItemListWidget* item);
virtual bool event(QEvent* event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
QList<KItemListWidget*> visibleItemListWidgets() const;
KItemListViewAnimation::AnimationType type);
void slotLayoutTimerFinished();
+ void slotRubberBandStartPosChanged();
+ void slotRubberBandEndPosChanged();
+ void slotRubberBandActivationChanged(bool active);
+
private:
enum LayoutAnimationHint
{
void setController(KItemListController* controller);
void setModel(KItemModelBase* model);
+ KItemListRubberBand* rubberBand() const;
+
void updateLayout();
void doLayout(LayoutAnimationHint hint, int changedIndex, int changedCount);
void doGroupHeadersLayout(LayoutAnimationHint hint, int changedIndex, int changedCount);
*/
void updateWidgetProperties(KItemListWidget* widget, int index);
+ /**
+ * Emits the signal scrollTo() with the corresponding target offset if the current
+ * mouse position is above the autoscroll-margin.
+ */
+ void triggerAutoScrolling();
+
+ /**
+ * 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.
+ */
+ static int calculateAutoScrollingIncrement(int pos, int size);
+
private:
+ bool m_autoScrollMarginEnabled;
bool m_grouped;
int m_activeTransactions; // Counter for beginTransaction()/endTransaction()
KItemListViewAnimation* m_animation;
QTimer* m_layoutTimer; // Triggers an asynchronous doLayout() call.
- int m_oldOffset;
- int m_oldMaximumOffset;
+ qreal m_oldOffset;
+ qreal m_oldMaximumOffset;
+
+ KItemListRubberBand* m_rubberBand;
+
+ QPointF m_mousePos;
friend class KItemListController;
};