working, needs a lot of improvements

pull/20439/head
iejMac 4 years ago
parent 5c268a03a3
commit 17fe0ec6ae
  1. 16
      selfdrive/ui/qt/offroad/onboarding.cc
  2. 4
      selfdrive/ui/qt/offroad/onboarding.hpp
  3. 3
      selfdrive/ui/qt/offroad/terms.qml

@ -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<QObject*>("flickArea");
flickable = obj->findChild<QObject*>("flickArea");
QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(accept_buttons()));

@ -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();

@ -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

Loading…
Cancel
Save