Skip to content

Commit

Permalink
cabana: fix mouse wheel not scrolling charts when hovering over tips (c…
Browse files Browse the repository at this point in the history
…ommaai#33747)

fix mouse wheel not scrolling charts when hovering over tips
  • Loading branch information
deanlee authored Oct 8, 2024
1 parent 6547d95 commit 19fdf90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/cabana/chart/chartswidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ void ChartsWidget::alignCharts() {
}

bool ChartsWidget::eventFilter(QObject *o, QEvent *e) {
if (value_tip_visible_ && e->type() == QEvent::MouseMove) {
if (!value_tip_visible_) return false;

if (e->type() == QEvent::MouseMove) {
bool on_tip = qobject_cast<TipLabel *>(o) != nullptr;
auto global_pos = static_cast<QMouseEvent *>(e)->globalPos();

Expand All @@ -449,6 +451,11 @@ bool ChartsWidget::eventFilter(QObject *o, QEvent *e) {
}

showValueTip(-1);
} else if (e->type() == QEvent::Wheel) {
if (auto tip = qobject_cast<TipLabel *>(o)) {
// Forward the event to the parent widget
QCoreApplication::sendEvent(tip->parentWidget(), e);
}
}
return false;
}
Expand Down

0 comments on commit 19fdf90

Please sign in to comment.