Files
oscarpilot/selfdrive/ui/qt/body.cc
Your Name 638378439e wip
2024-02-13 19:19:51 -06:00

61 lines
1.3 KiB
C++

#include "selfdrive/ui/qt/body.h"
#include <cmath>
#include <algorithm>
#include <QPainter>
#include <QStackedLayout>
#include <QApplication>
#include <QGridLayout>
#include <QString>
#include <QTransform>
#include <QPixmap>
#include "common/params.h"
#include "common/timing.h"
#include "system/hardware/hw.h"
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/ui/qt/util.h"
void LogoWidget::paintEvent(QPaintEvent *event) {
QPainter painter(this);
}
BodyWindow::BodyWindow(QWidget *parent) : QWidget(parent) {
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setMargin(200);
setAttribute(Qt::WA_OpaquePaintEvent);
setStyleSheet(R"(
BodyWindow {
background-color: blue;
}
)");
QObject::connect(uiState(), &UIState::uiUpdate, this, &BodyWindow::updateState);
}
void BodyWindow::paintEvent(QPaintEvent *event) {
QPainter painter(this);
QPixmap comma_img = loadPixmap("../assets/img_spinner_comma.png");
// Calculate the top-left position to center the image in the window.
int x = (this->width() - comma_img.width()) / 2;
int y = (this->height() - comma_img.height()) / 2;
// Draw the pixmap at the calculated position.
painter.drawPixmap(x, y, comma_img);
}
void BodyWindow::updateState(const UIState &s) {
}
void BodyWindow::offroadTransition(bool offroad) {
}