    chart->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    chart->chart()->setTheme(use_dark_theme ? QChart::QChart::ChartThemeDark : QChart::ChartThemeLight);
    QObject::connect(chart, &ChartView::remove, [=]() { removeChart(chart); });
    QObject::connect(chart, &ChartView::zoomIn, this, &ChartsWidget::zoomIn);
    QObject::connect(chart, &ChartView::zoomReset, this, &ChartsWidget::zoomReset);
    QObject::connect(chart, &ChartView::seriesRemoved, this, &ChartsWidget::seriesChanged);
    QObject::connect(chart, &ChartView::seriesAdded, this, &ChartsWidget::seriesChanged);
    QObject::connect(chart, &ChartView::axisYLabelWidthChanged, &align_timer, qOverload<>(&QTimer::start));
    charts.push_back(chart);
    updateLayout();
 
</s> remove     // loop in zoommed range
 </s> add     // loop in zoomed range </s> remove   zoomIn(display_range.first, display_range.second);
 </s> add   setZoom(display_range.first, display_range.second);
}

void ChartsWidget::zoomUndo() {
  if (!zoom_stack.isEmpty()) {
    auto r = zoom_stack.pop();
    setZoom(r.first, r.second);
  } else {
    zoomReset();
  }
  QObject::connect(chart, &ChartView::zoomUndo, this, &ChartsWidget::zoomUndo);
    chart->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    chart->chart()->setTheme(use_dark_theme ? QChart::QChart::ChartThemeDark : QChart::ChartThemeLight);
    QObject::connect(chart, &ChartView::remove, [=]() { removeChart(chart); });
    QObject::connect(chart, &ChartView::zoomIn, this, &ChartsWidget::zoomIn);
  QObject::connect(chart, &ChartView::zoomUndo, this, &ChartsWidget::zoomUndo);
    QObject::connect(chart, &ChartView::seriesRemoved, this, &ChartsWidget::seriesChanged);
    QObject::connect(chart, &ChartView::seriesAdded, this, &ChartsWidget::seriesChanged);
    QObject::connect(chart, &ChartView::axisYLabelWidthChanged, &align_timer, qOverload<>(&QTimer::start));
    charts.push_back(chart);
    updateLayout();
keep keep keep keep replace keep keep keep keep keep
 cabana: go to previous zoom window (#27702)

* cabana: go to previous zoom level

* zoom undo on right click

* catch mousepress event on linux 
tools/cabana/chartswidget.cc