Skip to content

Commit

Permalink
ui: remove QtQml and related dependencies (commaai#33357)
Browse files Browse the repository at this point in the history
* remove QtQml

* remove qtdeclarative5-dev
old-commit-hash: 4d9ee68
  • Loading branch information
deanlee authored Aug 23, 2024
1 parent 7dfe270 commit 7098ddc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 71 deletions.
5 changes: 1 addition & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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",
]
Expand Down
34 changes: 16 additions & 18 deletions selfdrive/ui/qt/offroad/onboarding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

#include <QLabel>
#include <QPainter>
#include <QQmlContext>
#include <QQuickWidget>
#include <QScrollBar>
#include <QTransform>
#include <QVBoxLayout>

#include "common/util.h"
#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);
Expand Down Expand Up @@ -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);
Expand All @@ -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() {
Expand Down
47 changes: 0 additions & 47 deletions selfdrive/ui/qt/offroad/text_view.qml

This file was deleted.

2 changes: 0 additions & 2 deletions tools/install_ubuntu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 7098ddc

Please sign in to comment.