diff --git a/plasma/widgets/scrollwidget.cpp b/plasma/widgets/scrollwidget.cpp index 69a90851..d1531767 100644 --- a/plasma/widgets/scrollwidget.cpp +++ b/plasma/widgets/scrollwidget.cpp @@ -51,34 +51,6 @@ #include #include - -#define DEBUG 0 - -/* - The flicking code is largely based on the behavior of - the flickable widget in QDeclerative so porting between - the two should preserve the behavior. - The code that figures out velocity could use some - improvements, in particular IGNORE_SUSPICIOUS_MOVES - is a hack that shouldn't be necessary. - */ - -//XXX fixme -// we use a timer between move events to figure out -// the velocity of a move, but sometimes we're getting move -// events with big positional changes with no break -// in between them, which causes us to compute -// huge velocities. this define just filters out -// events which come at insanly small time intervals. -// at some point we need to figure out how to do it properly -#define IGNORE_SUSPICIOUS_MOVES 1 - -// FlickThreshold determines how far the "mouse" must have moved -// before we perform a flick. -static const int FlickThreshold = 20; - - -static const qreal MinimumFlickVelocity = 200; static const qreal MaxVelocity = 2000; // time it takes the widget to flick back to its @@ -93,11 +65,11 @@ class ScrollWidgetPrivate public: ScrollWidgetPrivate(ScrollWidget *parent) : q(parent), - topBorder(0), - bottomBorder(0), - leftBorder(0), - rightBorder(0), - overflowBordersVisible(true) + topBorder(0), + bottomBorder(0), + leftBorder(0), + rightBorder(0), + overflowBordersVisible(true) { } @@ -155,7 +127,6 @@ public: fixupAnimation.snapX = 0; fixupAnimation.snapY = 0; directMoveAnimation = 0; - stealEvent = false; hasOvershoot = true; alignment = (Qt::AlignLeft | Qt::AlignTop); @@ -353,12 +324,12 @@ public: // -ve velocity means list is moving up if (velocity > 0) { if (val < minExtent) - maxDistance = qAbs(minExtent - val + (hasOvershoot?overShootDistance(velocity,size):0)); + maxDistance = qAbs(minExtent - val + (hasOvershoot ? overShootDistance(velocity,size) : 0)); target = minExtent; deceleration = -deceleration; } else { if (val > maxExtent) - maxDistance = qAbs(maxExtent - val) + (hasOvershoot?overShootDistance(velocity,size):0); + maxDistance = qAbs(maxExtent - val) + (hasOvershoot ? overShootDistance(velocity,size) : 0); target = maxExtent; } if (maxDistance > 0) { @@ -384,15 +355,15 @@ public: } duration = qAbs((endY-startY)/ (-v/2)); -#if DEBUG - qDebug()<<"XXX velocity = "<type()) { - case QEvent::GraphicsSceneMousePress: { - d->handleMousePressEvent(static_cast(e)); - break; - } - case QEvent::GraphicsSceneMouseMove: { - d->handleMouseMoveEvent(static_cast(e)); - break; - } - case QEvent::GraphicsSceneMouseRelease: { - d->handleMouseReleaseEvent(static_cast(e)); - break; - } - default: { - break; - } - } - if (stealThisEvent) - return true; - return QGraphicsWidget::sceneEventFilter(i, e); -} - void Plasma::ScrollWidget::setAlignment(Qt::Alignment align) { d->alignment = align; diff --git a/plasma/widgets/scrollwidget.h b/plasma/widgets/scrollwidget.h index a94c499d..7b603bf7 100644 --- a/plasma/widgets/scrollwidget.h +++ b/plasma/widgets/scrollwidget.h @@ -221,15 +221,11 @@ Q_SIGNALS: protected: void resizeEvent(QGraphicsSceneResizeEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void keyPressEvent(QKeyEvent *event); void wheelEvent(QGraphicsSceneWheelEvent *event); bool eventFilter(QObject *watched, QEvent *event); void focusInEvent(QFocusEvent *event); QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const; - bool sceneEventFilter(QGraphicsItem *i, QEvent *e); private: ScrollWidgetPrivate * const d;