bool QScrollerPrivate::releaseWhileDragging(const QPointF &position, qint64 timestamp) { //qDebug() << "releaseWhileDragging()"; Q_Q(QScroller); const QScrollerPropertiesPrivate *sp = properties.d.data(); // handleDrag updates lastPosition, lastTimestamp and velocity handleDrag(position, timestamp); // check if we moved at all - this can happen if you stop a running // scroller with a press and release shortly afterwards QPointF deltaPixel = position - pressPosition; if (((deltaPixel / q->pixelPerMeter()).manhattanLength()) > sp->dragStartDistance) { // handle accelerating flicks if ((oldVelocity != QPointF(0, 0)) && sp->acceleratingFlickMaximumTime && ((timestamp - pressTimestamp) < qint64(sp->acceleratingFlickMaximumTime * 1000))) { qDebug() << "NEW---PATCH-----------APPLIED-------releaseVelocity: "<< releaseVelocity; // - determine if the direction was changed int signX = 0, signY = 0; if (releaseVelocity.x()) signX = (releaseVelocity.x() > 0) == (oldVelocity.x() > 0) ? 1 : -1; if (releaseVelocity.y()) signY = (releaseVelocity.y() > 0) == (oldVelocity.y() > 0) ? 1 : -1; if (signX > 0 && qAbs(releaseVelocity.x()) > qAbs(oldVelocity.x())) releaseVelocity.setX(qBound(-sp->maximumVelocity, oldVelocity.x() * sp->acceleratingFlickSpeedupFactor, sp->maximumVelocity)); if (signY > 0 && qAbs(releaseVelocity.y()) > qAbs(oldVelocity.y())) releaseVelocity.setY(qBound(-sp->maximumVelocity, oldVelocity.y() * sp->acceleratingFlickSpeedupFactor, sp->maximumVelocity)); } } QPointF ppm = q->pixelPerMeter(); createScrollingSegments(releaseVelocity, contentPosition + overshootPosition, ppm); qScrollerDebug() << "QScroller::releaseWhileDragging() -- velocity:" << releaseVelocity << "-- minimum velocity:" << sp->minimumVelocity << "overshoot" << overshootPosition; if (xSegments.isEmpty() && ySegments.isEmpty()) setState(QScroller::Inactive); else setState(QScroller::Scrolling); return true; }