I'm using QScroller on my QListView.
How can I stop dragging the list away when it reaches its beginning or its end?
Like image below.
You have to set the overshoot policy of the QScrollerProperties
. Here an example for the vertical scrolling:
QScrollerProperties properties = QScroller::scroller(scrollWidget)->scrollerProperties();
QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff);
properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy);
QScroller::scroller(scrollWidget)->setScrollerProperties(properties);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With