mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Print/pdf export related cosmetics
This commit is contained in:
parent
ffcba53b91
commit
f334901db3
@ -242,13 +242,15 @@ void GraphView::plot(QPainter *painter, const QRectF &target)
|
||||
QSizeF orig = _scene->sceneRect().size();
|
||||
QSizeF canvas = QSizeF(orig.height() * ratio, orig.height());
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
redraw(canvas);
|
||||
_slider->hide();
|
||||
_info->hide();
|
||||
_scene->render(painter, target, QRectF());
|
||||
_scene->removeItem(_info);
|
||||
_scene->render(painter, target, _scene->itemsBoundingRect());
|
||||
_scene->addItem(_info);
|
||||
_slider->show();
|
||||
_info->show();
|
||||
redraw(orig);
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
void GraphView::clear()
|
||||
|
@ -351,6 +351,7 @@ void TrackView::plot(QPainter *painter, const QRectF &target)
|
||||
QRect orig, adj;
|
||||
qreal ratio, diff;
|
||||
|
||||
|
||||
orig = viewport()->rect();
|
||||
|
||||
if (target.width()/target.height() > orig.width()/orig.height()) {
|
||||
@ -363,13 +364,21 @@ void TrackView::plot(QPainter *painter, const QRectF &target)
|
||||
adj = orig.adjusted(0, -diff/2, 0, diff/2);
|
||||
}
|
||||
|
||||
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight()
|
||||
+ QPoint(-_mapScale->boundingRect().width(),
|
||||
-_mapScale->boundingRect().height()))));
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
_plot = true;
|
||||
|
||||
QPointF pos = _mapScale->pos();
|
||||
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height())))));
|
||||
|
||||
render(painter, target, adj);
|
||||
|
||||
_mapScale->setPos(pos);
|
||||
|
||||
_plot = false;
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
enum QPrinter::Orientation TrackView::orientation() const
|
||||
@ -487,7 +496,8 @@ void TrackView::resizeEvent(QResizeEvent *e)
|
||||
|
||||
void TrackView::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QPointF scenePos = mapToScene(rect().bottomLeft() + QPoint(SCALE_OFFSET,
|
||||
QPointF scenePos = mapToScene(rect().bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height())));
|
||||
if (_mapScale->pos() != scenePos && !_plot)
|
||||
_mapScale->setPos(scenePos);
|
||||
|
Loading…
Reference in New Issue
Block a user