Skip to content

Commit

Permalink
update qt setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Comma Device committed Apr 2, 2021
1 parent 7e63290 commit 204d878
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions selfdrive/ui/qt/offroad/networking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QPixmap>

#include "networking.hpp"
#include "widgets/scrollview.hpp"

void clearLayout(QLayout* layout) {
while (QLayoutItem* item = layout->takeAt(0)) {
Expand Down Expand Up @@ -57,9 +58,9 @@ void Networking::attemptInitialization(){
vlayout->addSpacing(10);
}

wifiWidget = new WifiUI(0, wifi);
wifiWidget = new WifiUI(this, wifi);
connect(wifiWidget, SIGNAL(connectToNetwork(Network)), this, SLOT(connectToNetwork(Network)));
vlayout->addWidget(wifiWidget, 1);
vlayout->addWidget(new ScrollView(wifiWidget, this), 1);

QWidget* wifiScreen = new QWidget(this);
wifiScreen->setLayout(vlayout);
Expand Down
20 changes: 11 additions & 9 deletions selfdrive/ui/qt/setup/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ QWidget * Setup::build_page(QString title, QWidget *content, bool next, bool pre

QHBoxLayout *nav_layout = new QHBoxLayout();

QPushButton *back_btn = new QPushButton("Back");
nav_layout->addWidget(back_btn, 0, Qt::AlignBottom | Qt::AlignLeft);
QObject::connect(back_btn, SIGNAL(released()), this, SLOT(prevPage()));
back_btn->setVisible(prev);

QPushButton *continue_btn = new QPushButton("Continue");
nav_layout->addWidget(continue_btn, 0, Qt::AlignBottom | Qt::AlignRight);
QObject::connect(continue_btn, SIGNAL(released()), this, SLOT(nextPage()));
continue_btn->setVisible(next);
if (prev) {
QPushButton *back_btn = new QPushButton("Back");
nav_layout->addWidget(back_btn, 1, Qt::AlignBottom | Qt::AlignLeft);
QObject::connect(back_btn, SIGNAL(released()), this, SLOT(prevPage()));
}

if (next) {
QPushButton *continue_btn = new QPushButton("Continue");
nav_layout->addWidget(continue_btn, 0, Qt::AlignBottom | Qt::AlignRight);
QObject::connect(continue_btn, SIGNAL(released()), this, SLOT(nextPage()));
}

main_layout->addLayout(nav_layout, 0);

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/widgets/scrollview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ScrollView::ScrollView(QWidget *w, QWidget *parent) : QScrollArea(parent){
setWidgetResizable(true);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setStyleSheet("background-color:transparent;");
setStyleSheet("ScrollView { background-color:transparent; }");

QScroller *scroller = QScroller::scroller(this->viewport());
QScrollerProperties sp = scroller->scrollerProperties();
Expand Down

0 comments on commit 204d878

Please sign in to comment.