new and improved text window

pull/2626/head
Adeeb Shihadeh 5 years ago
parent 9d18b45cd0
commit 696c3cd58c
  1. 47
      selfdrive/ui/qt/text.cc

@ -1,6 +1,3 @@
#include <cstdlib>
#include <QString>
#include <QLabel> #include <QLabel>
#include <QWidget> #include <QWidget>
#include <QPushButton> #include <QPushButton>
@ -11,22 +8,14 @@
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QApplication a(argc, argv); QApplication a(argc, argv);
QWidget *window = new QWidget(); QWidget window;
setMainWindow(window); setMainWindow(&window);
QVBoxLayout *main_layout = new QVBoxLayout();
QString text = ""; QVBoxLayout *layout = new QVBoxLayout();
for (int i = 1; i < argc; i++) { layout->setContentsMargins(30, 30, 30, 30);
if (i > 1) {
text.append(" ");
}
text.append(argv[i]);
}
QLabel *label = new QLabel(text); // TODO: make this scroll
label->setAlignment(Qt::AlignTop); layout->addWidget(new QLabel(argv[1]), 0, Qt::AlignTop);
main_layout->addWidget(label);
QPushButton *btn = new QPushButton(); QPushButton *btn = new QPushButton();
#ifdef __aarch64__ #ifdef __aarch64__
@ -38,26 +27,20 @@ int main(int argc, char *argv[]) {
btn->setText("Exit"); btn->setText("Exit");
QObject::connect(btn, SIGNAL(released()), &a, SLOT(quit())); QObject::connect(btn, SIGNAL(released()), &a, SLOT(quit()));
#endif #endif
main_layout->addWidget(btn); layout->addWidget(btn, 0, Qt::AlignRight);
window->setLayout(main_layout); window.setLayout(layout);
window->setStyleSheet(R"( window.setStyleSheet(R"(
QWidget { * {
margin: 60px;
background-color: black;
}
QLabel {
color: white; color: white;
background-color: black;
font-size: 60px; font-size: 60px;
} }
QPushButton { QPushButton {
color: white; padding: 50px;
font-size: 50px; padding-right: 100px;
padding: 60px; padding-left: 100px;
margin-left: 1500px; border: 2px solid white;
border-color: white;
border-width: 2px;
border-style: solid;
border-radius: 20px; border-radius: 20px;
} }
)"); )");

Loading…
Cancel
Save