Skip to content

Commit

Permalink
Improve the graph clearing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Sep 20, 2024
1 parent 672fca9 commit c68a2a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/GUI/graphview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ QRectF GraphView::bounds() const

void GraphView::redraw()
{
if (!_graphs.isEmpty())
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
}

void GraphView::redraw(const QSizeF &size)
Expand All @@ -275,7 +274,6 @@ void GraphView::redraw(const QSizeF &size)
RangeF rx, ry;
qreal sx, sy;


if (_bounds.isNull()) {
removeItem(_xAxis);
removeItem(_yAxis);
Expand All @@ -284,7 +282,10 @@ void GraphView::redraw(const QSizeF &size)
removeItem(_slider);
removeItem(_info);
removeItem(_grid);
addItem(_message);
if (_graphs.isEmpty())
removeItem(_message);
else
addItem(_message);
_scene->setSceneRect(_scene->itemsBoundingRect());
return;
}
Expand Down Expand Up @@ -357,8 +358,7 @@ void GraphView::redraw(const QSizeF &size)

void GraphView::resizeEvent(QResizeEvent *e)
{
if (!_graphs.isEmpty())
redraw(e->size() - QSizeF(MARGIN, MARGIN));
redraw(e->size() - QSizeF(MARGIN, MARGIN));

QGraphicsView::resizeEvent(e);
}
Expand Down

0 comments on commit c68a2a1

Please sign in to comment.