diff --git a/SConstruct b/SConstruct index ca0c9e28f9216d..c3e0f5805c08fd 100644 --- a/SConstruct +++ b/SConstruct @@ -266,7 +266,7 @@ Export('envCython', 'np_version') # Qt build environment qt_env = env.Clone() -qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Quick", "Qml", "QuickWidgets", "DBus", "Xml"] +qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "DBus", "Xml"] qt_libs = [] if arch == "Darwin": @@ -312,9 +312,6 @@ qt_flags = [ "-DQT_NO_DEBUG", "-DQT_WIDGETS_LIB", "-DQT_GUI_LIB", - "-DQT_QUICK_LIB", - "-DQT_QUICKWIDGETS_LIB", - "-DQT_QML_LIB", "-DQT_CORE_LIB", "-DQT_MESSAGELOGCONTEXT", ] diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index b1219055fd07ae..bae7e3bdf31ef9 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -4,8 +4,7 @@ #include #include -#include -#include +#include #include #include @@ -13,6 +12,7 @@ #include "common/params.h" #include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/widgets/input.h" +#include "selfdrive/ui/qt/widgets/scrollview.h" TrainingGuide::TrainingGuide(QWidget *parent) : QFrame(parent) { setAttribute(Qt::WA_OpaquePaintEvent); @@ -98,25 +98,17 @@ void TermsPage::showEvent(QShowEvent *event) { title->setStyleSheet("font-size: 90px; font-weight: 600;"); main_layout->addWidget(title); - main_layout->addSpacing(30); - - QQuickWidget *text = new QQuickWidget(this); - text->setResizeMode(QQuickWidget::SizeRootObjectToView); - text->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - text->setAttribute(Qt::WA_AlwaysStackOnTop); - text->setClearColor(QColor("#1B1B1B")); - - QString text_view = util::read_file("../assets/offroad/tc.html").c_str(); - text->rootContext()->setContextProperty("text_view", text_view); - - text->setSource(QUrl::fromLocalFile("qt/offroad/text_view.qml")); + QLabel *text = new QLabel(this); + text->setTextFormat(Qt::RichText); + text->setWordWrap(true); + text->setText(QString::fromStdString(util::read_file("../assets/offroad/tc.html"))); + text->setStyleSheet("font-size:50px; font-weight: 200; color: #C9C9C9; background-color:#1B1B1B; padding:50px 50px;"); + ScrollView *scroll = new ScrollView(text, this); - main_layout->addWidget(text, 1); + main_layout->addSpacing(30); + main_layout->addWidget(scroll); main_layout->addSpacing(50); - QObject *obj = (QObject*)text->rootObject(); - QObject::connect(obj, SIGNAL(scroll()), SLOT(enableAccept())); - QHBoxLayout* buttons = new QHBoxLayout; buttons->setMargin(0); buttons->setSpacing(45); @@ -141,6 +133,12 @@ void TermsPage::showEvent(QShowEvent *event) { )"); buttons->addWidget(accept_btn); QObject::connect(accept_btn, &QPushButton::clicked, this, &TermsPage::acceptedTerms); + QScrollBar *scroll_bar = scroll->verticalScrollBar(); + connect(scroll_bar, &QScrollBar::valueChanged, this, [this, scroll_bar](int value) { + if (value == scroll_bar->maximum()) { + enableAccept(); + } + }); } void TermsPage::enableAccept() { diff --git a/selfdrive/ui/qt/offroad/text_view.qml b/selfdrive/ui/qt/offroad/text_view.qml deleted file mode 100644 index 10b423bacbd09b..00000000000000 --- a/selfdrive/ui/qt/offroad/text_view.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.0 - -Item { - id: root - signal scroll() - - Flickable { - id: flickArea - objectName: "flickArea" - anchors.fill: parent - contentHeight: helpText.height - contentWidth: width - (leftMargin + rightMargin) - bottomMargin: 50 - topMargin: 50 - rightMargin: 50 - leftMargin: 50 - flickableDirection: Flickable.VerticalFlick - flickDeceleration: 7500.0 - maximumFlickVelocity: 10000.0 - pixelAligned: true - - onAtYEndChanged: root.scroll() - - Text { - id: helpText - width: flickArea.contentWidth - font.family: "Inter" - font.weight: "Light" - font.pixelSize: 50 - textFormat: Text.RichText - color: "#C9C9C9" - wrapMode: Text.Wrap - text: text_view - } - } - - Rectangle { - id: scrollbar - anchors.right: flickArea.right - anchors.rightMargin: 20 - y: flickArea.topMargin + flickArea.visibleArea.yPosition * (flickArea.height - flickArea.bottomMargin - flickArea.topMargin) - width: 12 - radius: 6 - height: flickArea.visibleArea.heightRatio * (flickArea.height - flickArea.bottomMargin - flickArea.topMargin) - color: "#808080" - } -} diff --git a/tools/install_ubuntu_dependencies.sh b/tools/install_ubuntu_dependencies.sh index 2996127ecd6851..33e6d9c86309f2 100755 --- a/tools/install_ubuntu_dependencies.sh +++ b/tools/install_ubuntu_dependencies.sh @@ -59,8 +59,6 @@ function install_ubuntu_common_requirements() { ocl-icd-libopencl1 \ ocl-icd-opencl-dev \ portaudio19-dev \ - qml-module-qtquick2 \ - qtdeclarative5-dev \ qttools5-dev-tools \ libqt5svg5-dev \ libqt5serialbus5-dev \