| 743 | } |
| 744 | |
| 745 | void Viewer::animateScroll(QPropertyAnimation &scroller, const QScrollBar &scrollBar, int delta) |
| 746 | { |
| 747 | int deltaNotFinished = 0; |
| 748 | if (scroller.state() == QAbstractAnimation::Running) { |
| 749 | deltaNotFinished = scroller.startValue().toInt() - scroller.endValue().toInt(); |
| 750 | scroller.stop(); |
| 751 | } |
| 752 | |
| 753 | const int currentPos = scrollBar.sliderPosition(); |
| 754 | scroller.setDuration(animationDuration()); |
| 755 | scroller.setStartValue(currentPos); |
| 756 | scroller.setEndValue(currentPos - delta - deltaNotFinished); |
| 757 | |
| 758 | scroller.start(); |
| 759 | } |
| 760 | |
| 761 | void Viewer::wheelEvent(QWheelEvent *event) |
| 762 | { |