diff --git a/src/gui.cpp b/src/gui.cpp index c860a8d7..dbe2122f 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -703,11 +703,17 @@ void GUI::plot(QPrinter *printer) 0) + UNIT_SPACE + tr("m")); } - _track->plot(&p, QRectF(0, 300, printer->width(), (0.80 * printer->height()) - - 400)); - _elevationGraph->plot(&p, QRectF(0, 0.80 * printer->height(), - printer->width(), printer->height() * 0.20)); - info.plot(&p, QRectF(0, 0, printer->width(), 200)); + if (_elevationGraph->count()) { + _track->plot(&p, QRectF(0, 300, printer->width(), + (0.80 * printer->height()) - 400)); + _elevationGraph->plot(&p, QRectF(0, 0.80 * printer->height(), + printer->width(), printer->height() * 0.20)); + info.plot(&p, QRectF(0, 0, printer->width(), 200)); + } else { + _track->plot(&p, QRectF(0, 300, printer->width(), + printer->height() - 300)); + info.plot(&p, QRectF(0, 0, printer->width(), 200)); + } } void GUI::reloadFile() diff --git a/src/trackview.cpp b/src/trackview.cpp index ae6df057..1efee1e2 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -354,7 +354,7 @@ void TrackView::plot(QPainter *painter, const QRectF &target) orig = viewport()->rect(); - if (target.width()/target.height() > orig.width()/orig.height()) { + if (target.width() > target.height()) { ratio = target.width()/target.height(); diff = qAbs((orig.height() * ratio) - orig.width()); adj = orig.adjusted(-diff/2, 0, diff/2, 0); @@ -364,7 +364,6 @@ void TrackView::plot(QPainter *painter, const QRectF &target) adj = orig.adjusted(0, -diff/2, 0, diff/2); } - setUpdatesEnabled(false); _plot = true;