From 66a7d0b8a3ac70bb1b9f02f60ea63e5419d9b8eb Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sat, 25 Mar 2023 12:54:41 +0800 Subject: [PATCH] cabana: enables user to select the zoom area when the mouse press on the data point (#27679) zoom anywhere old-commit-hash: 33afefd346e4348aacb122a486066741731b7d05 --- tools/cabana/chartswidget.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/cabana/chartswidget.cc b/tools/cabana/chartswidget.cc index c98ca3bc69..72c9e1ba91 100644 --- a/tools/cabana/chartswidget.cc +++ b/tools/cabana/chartswidget.cc @@ -9,8 +9,9 @@ #include #include #include -#include +#include #include +#include #include #include #include @@ -849,6 +850,13 @@ QXYSeries *ChartView::createSeries(SeriesType type, QColor color) { chart()->addSeries(series); series->attachAxis(axis_x); series->attachAxis(axis_y); + + // disables the delivery of mouse events to the opengl widget. + // this enables the user to select the zoom area when the mouse press on the data point. + auto glwidget = findChild(); + if (glwidget && !glwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + glwidget->setAttribute(Qt::WA_TransparentForMouseEvents); + } return series; }