diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 2bce693..5b89787 100755 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -29,6 +29,8 @@ // p.restore(); // } +bool alert_is_visible = false; + OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) { QVBoxLayout *main_layout = new QVBoxLayout(this); main_layout->setMargin(UI_BORDER_SIZE); @@ -232,6 +234,8 @@ void OnroadAlerts::updateAlert(const Alert &a) { } void OnroadAlerts::paintEvent(QPaintEvent *event) { + alert_is_visible = false; + if (alert.size == cereal::ControlsState::AlertSize::NONE) { return; } @@ -240,6 +244,8 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) { return; } + alert_is_visible = true; + static std::map alert_heights = { {cereal::ControlsState::AlertSize::SMALL, 271}, {cereal::ControlsState::AlertSize::MID, 420}, @@ -386,7 +392,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { p.save(); int screenDisaplayMode = paramsMemory.getInt("ScreenDisaplayMode"); - if (screenDisaplayMode == 1 && !alert->isVisible()) { + if (screenDisaplayMode == 1 && !alert_is_visible) { // Draw black, filled, full-size rectangle to blank the screen // p.fillRect(0, 0, width(), height(), Qt::black); // p.restore();