cabana: optimize chart update (#26327)

optimize update
old-commit-hash: 4c90bb8635d460c1a574f3ab3d7aa264179c197e
This commit is contained in:
Dean Lee
2022-11-03 01:45:54 +08:00
committed by GitHub
parent 6a7ce3a4d6
commit 9b00da46da
+3 -1
View File
@@ -325,7 +325,6 @@ void ChartView::updateLineMarker(double current_sec) {
chart()->plotArea().width() * (current_sec - axis_x->min()) / (axis_x->max() - axis_x->min());
if (int(line_marker->line().x1()) != x) {
line_marker->setLine(x, 0, x, height());
chart()->update();
}
}
@@ -410,6 +409,7 @@ void ChartView::mouseReleaseEvent(QMouseEvent *event) {
} else {
QGraphicsView::mouseReleaseEvent(event);
}
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
}
void ChartView::mouseMoveEvent(QMouseEvent *ev) {
@@ -436,6 +436,8 @@ void ChartView::mouseMoveEvent(QMouseEvent *ev) {
track_line->setVisible(value != vals.end());
value_text->setVisible(value != vals.end());
track_ellipse->setVisible(value != vals.end());
} else {
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
QChartView::mouseMoveEvent(ev);
}