diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index f5ad74d3119ff7..49c9fe961a6037 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -130,7 +130,7 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { propagateEvent = true; } else { recentlyTapped = true; - propagateEvent = true; + propagateEvent = true; } // propagation event to parent(HomeWindow) @@ -308,10 +308,13 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par main_layout->addWidget(experimental_btn, 0, Qt::AlignTop | Qt::AlignRight); map_settings_btn = new MapSettingsButton(this); - main_layout->addWidget(map_settings_btn, 0, Qt::AlignBottom | Qt::AlignRight); + const bool flip_side = rightHandDM || compass; + const bool move_up = false; + const bool move_up_top = compass; + main_layout->addWidget(map_settings_btn, 0, (flip_side ? Qt::AlignLeft : Qt::AlignRight) | (move_up ? Qt::AlignCenter : move_up_top ? Qt::AlignTop : Qt::AlignBottom)); dm_img = loadPixmap("../assets/img_driver_face.png", {img_size + 5, img_size + 5}); - + // FrogPilot images compass_inner_img = loadPixmap("../assets/images/compass_inner.png", {img_size, img_size}); @@ -377,7 +380,10 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { // hide map settings button for alerts and flip for right hand DM if (map_settings_btn->isEnabled()) { map_settings_btn->setVisible(!hideBottomIcons); - main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignBottom); + const bool flip_side = rightHandDM || compass; + const bool move_up = false; + const bool move_up_top = compass; + main_layout->setAlignment(map_settings_btn, (flip_side ? Qt::AlignLeft : Qt::AlignRight) | (move_up ? Qt::AlignCenter : move_up_top ? Qt::AlignTop : Qt::AlignBottom)); } } @@ -836,8 +842,7 @@ void AnnotatedCameraWidget::drawCompass(QPainter &p) { const int y = rect().bottom() - 20 - 140; // Enable Antialiasing - p.setRenderHint(QPainter::Antialiasing); - p.setRenderHint(QPainter::TextAntialiasing); + p.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); // Configure the circles p.setPen(QPen(Qt::white, 2)); @@ -858,7 +863,6 @@ void AnnotatedCameraWidget::drawCompass(QPainter &p) { p.restore(); // Draw the cardinal directions - p.setFont(InterFont(25, QFont::Bold)); const auto drawDirection = [&](const QString &text, const int from, const int to, const int align) { // Move the "E" and "W" directions a bit closer to the middle so they're more uniform const int offset = (text == "E") ? -5 : ((text == "W") ? 5 : 0); @@ -866,6 +870,7 @@ void AnnotatedCameraWidget::drawCompass(QPainter &p) { p.setOpacity((bearingDeg >= from && bearingDeg < to) ? 1.0 : 0.2); p.drawText(QRect(x - inner_compass + offset, y - inner_compass, btn_size, btn_size), align, text); }; + p.setFont(InterFont(25, QFont::Bold)); drawDirection("N", 0, 68, Qt::AlignTop | Qt::AlignHCenter); drawDirection("E", 23, 158, Qt::AlignRight | Qt::AlignVCenter); drawDirection("S", 113, 248, Qt::AlignBottom | Qt::AlignHCenter); @@ -889,12 +894,10 @@ void AnnotatedCameraWidget::drawCompass(QPainter &p) { const auto drawCompassElements = [&](const int angle) { const bool isCardinalDirection = angle % 90 == 0; const int lineLength = isCardinalDirection ? 15 : 10; - const int lineWidth = isCardinalDirection ? 3 : 1; bool isBold = abs(angle - static_cast(bearingDeg)) <= 7; // Set the current bearing degree value to bold p.setFont(QFont("Inter", 8, isBold ? QFont::Bold : QFont::Normal)); - p.setPen(QPen(Qt::white, lineWidth)); // Place the elements in their respective spots around their circles p.save(); @@ -910,4 +913,6 @@ void AnnotatedCameraWidget::drawCompass(QPainter &p) { for (int i = 0; i < 360; i += 15) { drawCompassElements(i); } + + p.restore(); } \ No newline at end of file