mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-25 16:02:14 +08:00
stacked widget
This commit is contained in:
@@ -31,7 +31,7 @@ if arch in ["x86_64", "Darwin", "larch64"]:
|
||||
]
|
||||
|
||||
qt_env.Tool('qt')
|
||||
qt_env['CPPPATH'] += qt_dirs
|
||||
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
|
||||
qt_flags = [
|
||||
"-D_REENTRANT",
|
||||
"-DQT_NO_DEBUG",
|
||||
@@ -86,5 +86,5 @@ else:
|
||||
|
||||
# setup and installer
|
||||
if "BUILD_SETUP" in os.environ:
|
||||
qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc"], LIBS=qt_libs + libs + ['curl'])
|
||||
qt_env.Program("qt/setup/installer", ["qt/setup/installer.cc"], LIBS=qt_libs + libs)
|
||||
qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc"], LIBS=qt_libs + ['curl'])
|
||||
qt_env.Program("qt/setup/installer", ["qt/setup/installer.cc"], LIBS=qt_libs)
|
||||
|
||||
@@ -36,10 +36,8 @@ int download(std::string url) {
|
||||
QLabel * title_label(QString text) {
|
||||
QLabel *l = new QLabel(text);
|
||||
l->setStyleSheet(R"(
|
||||
QLabel {
|
||||
font-size: 100px;
|
||||
font-weight: bold;
|
||||
}
|
||||
font-size: 100px;
|
||||
font-weight: bold;
|
||||
)");
|
||||
return l;
|
||||
}
|
||||
@@ -60,8 +58,6 @@ QWidget * Setup::getting_started() {
|
||||
main_layout->addWidget(btn);
|
||||
QObject::connect(btn, SIGNAL(released()), this, SLOT(nextPage()));
|
||||
|
||||
main_layout->addSpacing(100);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(main_layout);
|
||||
return widget;
|
||||
@@ -125,26 +121,21 @@ QWidget * Setup::downloading() {
|
||||
}
|
||||
|
||||
void Setup::nextPage() {
|
||||
layout->setCurrentIndex(layout->currentIndex() + 1);
|
||||
setCurrentIndex(currentIndex() + 1);
|
||||
|
||||
// start download
|
||||
if (layout->currentIndex() == layout->count() - 1) {
|
||||
if (currentIndex() == count() - 1) {
|
||||
std::string url = url_input->text().toStdString();
|
||||
download(url);
|
||||
}
|
||||
}
|
||||
|
||||
Setup::Setup(QWidget *parent) {
|
||||
layout = new QStackedLayout();
|
||||
layout->addWidget(getting_started());
|
||||
layout->addWidget(network_setup());
|
||||
layout->addWidget(software_selection());
|
||||
layout->addWidget(downloading());
|
||||
addWidget(getting_started());
|
||||
addWidget(network_setup());
|
||||
addWidget(software_selection());
|
||||
addWidget(downloading());
|
||||
|
||||
// TODO: this is needed to make first page not squished, why?
|
||||
layout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
setLayout(layout);
|
||||
setStyleSheet(R"(
|
||||
QWidget {
|
||||
color: white;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QStackedLayout>
|
||||
#include <QStackedWidget>
|
||||
|
||||
class Setup : public QWidget {
|
||||
class Setup : public QStackedWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Setup(QWidget *parent = 0);
|
||||
|
||||
private:
|
||||
QStackedLayout *layout;
|
||||
|
||||
QLineEdit *url_input;
|
||||
|
||||
QWidget *getting_started();
|
||||
|
||||
Reference in New Issue
Block a user