Files
cbh/ElaWidgetTools/private/ElaRollerPrivate.cpp
2025-09-20 01:41:33 +08:00

17 lines
556 B
C++

#include "ElaRollerPrivate.h"
#include <QPropertyAnimation>
ElaRollerPrivate::ElaRollerPrivate(QObject *parent) : QObject(parent) {}
ElaRollerPrivate::~ElaRollerPrivate() {}
void ElaRollerPrivate::_scroll(int delta) {
int steps = delta / 120;
_targetScrollOffset -= steps * _pItemHeight;
_targetScrollOffset = qRound(_targetScrollOffset / _pItemHeight) * _pItemHeight;
_scrollAnimation->stop();
_scrollAnimation->setStartValue(_pScrollOffset);
_scrollAnimation->setEndValue(_targetScrollOffset);
_scrollAnimation->start();
}