cabana: optimize chart update (#26327)

optimize update
pull/26329/head
Dean Lee 3 years ago committed by GitHub
parent 2fb7b4ffad
commit 4c90bb8635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      tools/cabana/chartswidget.cc

@ -325,7 +325,6 @@ void ChartView::updateLineMarker(double current_sec) {
chart()->plotArea().width() * (current_sec - axis_x->min()) / (axis_x->max() - axis_x->min()); chart()->plotArea().width() * (current_sec - axis_x->min()) / (axis_x->max() - axis_x->min());
if (int(line_marker->line().x1()) != x) { if (int(line_marker->line().x1()) != x) {
line_marker->setLine(x, 0, x, height()); line_marker->setLine(x, 0, x, height());
chart()->update();
} }
} }
@ -410,6 +409,7 @@ void ChartView::mouseReleaseEvent(QMouseEvent *event) {
} else { } else {
QGraphicsView::mouseReleaseEvent(event); QGraphicsView::mouseReleaseEvent(event);
} }
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
} }
void ChartView::mouseMoveEvent(QMouseEvent *ev) { void ChartView::mouseMoveEvent(QMouseEvent *ev) {
@ -436,6 +436,8 @@ void ChartView::mouseMoveEvent(QMouseEvent *ev) {
track_line->setVisible(value != vals.end()); track_line->setVisible(value != vals.end());
value_text->setVisible(value != vals.end()); value_text->setVisible(value != vals.end());
track_ellipse->setVisible(value != vals.end()); track_ellipse->setVisible(value != vals.end());
} else {
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
} }
QChartView::mouseMoveEvent(ev); QChartView::mouseMoveEvent(ev);
} }

Loading…
Cancel
Save