diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index 7f79a4fab1..cf500710d9 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -55,14 +55,10 @@ void TrainingGuide::paintEvent(QPaintEvent *event) { } void OnboardingWindow::accept_buttons(){ - /* - if(QQmlProperty::read(flick, "atYEnd").toBool()){ - accept_btn->setText("Accept"); - accept_btn->setEnabled(true); - } - return; - */ - printf("asdf\n"); + if(flickable->property("atYEnd").toInt()){ + accept_btn->setText("Accept"); + accept_btn->setEnabled(true); + } return; } @@ -86,7 +82,7 @@ QWidget* OnboardingWindow::terms_screen2() { buttons->addWidget(new QPushButton("Decline")); buttons->addSpacing(50); - QPushButton *accept_btn = new QPushButton("Scroll to accept"); + accept_btn = new QPushButton("Scroll to accept"); accept_btn->setEnabled(false); buttons->addWidget(accept_btn); QObject::connect(accept_btn, &QPushButton::released, [=]() { @@ -95,7 +91,7 @@ QWidget* OnboardingWindow::terms_screen2() { }); QObject *obj = (QObject*)view->rootObject(); - //QObject *flick = obj->findChild("flickArea"); + flickable = obj->findChild("flickArea"); QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(accept_buttons())); diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index b7aa30ecbf..7a13f9fe44 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -42,6 +42,10 @@ private: std::string current_terms_version; std::string current_training_version; + //TODO: Remove this (access through .widget(index)) + QPushButton *accept_btn; + QObject* flickable; + QTextEdit *terms_text; QWidget *terms_screen(); QWidget *terms_screen2(); diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index 7bee3d38b7..e72c2ac59d 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -14,13 +14,14 @@ Item { Flickable { id: flickArea + objectName: "flickArea" anchors.fill: parent contentHeight: helpText.height contentWidth: helpText.width flickableDirection: Flickable.VerticalFlick clip: true - onMovementStarted: root.qmlSignal("Hello") + onMovementEnded: root.qmlSignal("Hello") Text { // HTML like markup can also be used