mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
ui: remove QtQml and related dependencies (#33357)
* remove QtQml * remove qtdeclarative5-dev
This commit is contained in:
@@ -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",
|
||||
]
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickWidget>
|
||||
#include <QScrollBar>
|
||||
#include <QTransform>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -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);
|
||||
|
||||
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->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"));
|
||||
|
||||
main_layout->addWidget(text, 1);
|
||||
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() {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user