openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.

19 lines
903 B

#include "scrollview.hpp"
ScrollView::ScrollView(QWidget *w, QWidget *parent) : QScrollArea(parent){
setWidget(w);
setWidgetResizable(true);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
4 years ago
setStyleSheet("ScrollView { background-color:transparent; }");
QScroller *scroller = QScroller::scroller(this->viewport());
QScrollerProperties sp = scroller->scrollerProperties();
sp.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff));
sp.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff));
scroller->grabGesture(this->viewport(), QScroller::LeftMouseButtonGesture);
scroller->setScrollerProperties(sp);
}