mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Improve the graph clearing logic
This commit is contained in:
parent
672fca9dd5
commit
c68a2a1ac4
@ -264,7 +264,6 @@ QRectF GraphView::bounds() const
|
||||
|
||||
void GraphView::redraw()
|
||||
{
|
||||
if (!_graphs.isEmpty())
|
||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||
}
|
||||
|
||||
@ -275,7 +274,6 @@ void GraphView::redraw(const QSizeF &size)
|
||||
RangeF rx, ry;
|
||||
qreal sx, sy;
|
||||
|
||||
|
||||
if (_bounds.isNull()) {
|
||||
removeItem(_xAxis);
|
||||
removeItem(_yAxis);
|
||||
@ -284,6 +282,9 @@ void GraphView::redraw(const QSizeF &size)
|
||||
removeItem(_slider);
|
||||
removeItem(_info);
|
||||
removeItem(_grid);
|
||||
if (_graphs.isEmpty())
|
||||
removeItem(_message);
|
||||
else
|
||||
addItem(_message);
|
||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||
return;
|
||||
@ -357,7 +358,6 @@ void GraphView::redraw(const QSizeF &size)
|
||||
|
||||
void GraphView::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
if (!_graphs.isEmpty())
|
||||
redraw(e->size() - QSizeF(MARGIN, MARGIN));
|
||||
|
||||
QGraphicsView::resizeEvent(e);
|
||||
|
Loading…
Reference in New Issue
Block a user