void MPannableViewportScroller::stopScrolling(QGraphicsWidget *widget) { MPannableViewport *viewport = static_cast<MPannableViewport *>(widget); // Scroll to current position. This is effectively same as stopping the animation. viewport->d_func()->scrollTo(viewport->position(), 0); }
void MPannableViewportScroller::applyScrolling(QGraphicsWidget *widget, const QPoint &contentsOffset, int duration, const QEasingCurve &easingCurve) { MPannableViewport *viewport = static_cast<MPannableViewport *>(widget); viewport->d_func()->scrollTo(viewport->position() - contentsOffset, duration, easingCurve); // Disables kinetic scrolling until next pointer event. viewport->physics()->stop(); //TODO: After scrolling of every widget the topmost pannable viewport should make sure its range // covers at least the sip. }