Files
StarPilot/selfdrive/ui/qt/window.cc
T
Adeeb Shihadeh 4d2ccb3a79 qt settings style (#19588)
* dark mode

* inter

* frame

* this looks pretty good

* revert that

* fix bg hack

* don't override style sheet
old-commit-hash: 550b5e422f5ee7f7ca23d569cbd58f78bfdda9c5
2020-12-24 14:10:43 -08:00

46 lines
1.2 KiB
C++

#include "window.hpp"
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
main_layout = new QStackedLayout;
homeWindow = new HomeWindow(this);
main_layout->addWidget(homeWindow);
settingsWindow = new SettingsWindow(this);
main_layout->addWidget(settingsWindow);
onboardingWindow = new OnboardingWindow(this);
main_layout->addWidget(onboardingWindow);
main_layout->setMargin(0);
setLayout(main_layout);
QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings()));
QObject::connect(settingsWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
// start at onboarding
main_layout->setCurrentWidget(onboardingWindow);
QObject::connect(onboardingWindow, SIGNAL(onboardingDone()), this, SLOT(closeSettings()));
onboardingWindow->updateActiveScreen();
setStyleSheet(R"(
* {
font-family: Inter;
}
)");
}
void MainWindow::openSettings() {
main_layout->setCurrentWidget(settingsWindow);
}
void MainWindow::closeSettings() {
main_layout->setCurrentWidget(homeWindow);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
if (event->type() == QEvent::MouseButtonPress) {
homeWindow->glWindow->wake();
}
return false;
}