diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index 47909d7af1..d4250a71b4 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -12,6 +12,8 @@ #include "home.hpp" #include "util.h" +#include + void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { int leftOffset = (geometry().width()-1620)/2; @@ -85,11 +87,17 @@ QWidget* OnboardingWindow::terms_screen() { // TODO: tune the scrolling + auto sb = terms_text->verticalScrollBar(); QScrollerProperties sp; + /* sp.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001); + sp.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.5); + sp.setScrollMetric( QScrollerProperties::ScrollingCurve, QEasingCurve::Linear ); + sp.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.4); + */ + scroller = QScroller::scroller(terms_text); + scroller->setScrollerProperties(sp); - - auto sb = terms_text->verticalScrollBar(); #ifdef QCOM2 sb->setStyleSheet(R"( QScrollBar { @@ -105,7 +113,8 @@ QWidget* OnboardingWindow::terms_screen() { } )"); #else - QScroller::grabGesture(terms_text, QScroller::TouchGesture); + //QScroller::grabGesture(terms_text, QScroller::TouchGesture); + scroller->grabGesture(terms_text, QScroller::TouchGesture); terms_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); #endif diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index 3d51e5c7d3..55e8760805 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -40,6 +41,7 @@ private: QTextEdit *terms_text; QWidget *terms_screen(); QWidget *training_screen(); + QScroller *scroller; signals: void onboardingDone();