Skip to content

Commit 93699b0

Browse files
committed
reduce chart flickers while resizing
1 parent 2bf633d commit 93699b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/cabana/chartswidget.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ void ChartView::manageSeries() {
438438
}
439439

440440
void ChartView::resizeEvent(QResizeEvent *event) {
441-
QChartView::resizeEvent(event);
442441
updatePlotArea(align_to);
443442
int x = event->size().width() - close_btn_proxy->size().width() - 11;
444443
close_btn_proxy->setPos(x, 8);
445444
manage_btn_proxy->setPos(x - manage_btn_proxy->size().width() - 5, 8);
446445
move_icon->setPos(11, 8);
446+
QChartView::resizeEvent(event);
447447
}
448448

449449
void ChartView::updatePlotArea(int left) {
@@ -452,7 +452,7 @@ void ChartView::updatePlotArea(int left) {
452452
align_to = left;
453453
background->setRect(r);
454454
chart()->legend()->setGeometry(QRect(r.left(), r.top(), r.width(), 45));
455-
chart()->setPlotArea(QRect(align_to, r.top() + 45, r.width() - align_to - 22, r.height() - 80));
455+
chart()->setPlotArea(QRect(align_to, r.top() + 45, r.width() - align_to - 36, r.height() - 80));
456456
chart()->layout()->invalidate();
457457
}
458458
}
@@ -574,7 +574,7 @@ void ChartView::updateAxisY() {
574574

575575
QFontMetrics fm(axis_y->labelsFont());
576576
int n = qMax(int(-qFloor(std::log10((max_y - min_y) / (tick_count - 1)))), 0) + 1;
577-
y_label_width = qMax(fm.width(QString::number(min_y, 'f', n)), fm.width(QString::number(max_y, 'f', n))) + 20; // left margin 20
577+
y_label_width = qMax(fm.width(QString::number(min_y, 'f', n)), fm.width(QString::number(max_y, 'f', n))) + 15; // left margin 15
578578
emit axisYLabelWidthChanged(y_label_width);
579579
}
580580
}

0 commit comments

Comments
 (0)