mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Fixed track view resizing issues
This commit is contained in:
parent
6659e2ffa7
commit
d8068ad994
@ -339,3 +339,26 @@ void Track::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
painter->drawPixmap(tp, t.pixmap());
|
||||
}
|
||||
}
|
||||
|
||||
void Track::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
if (_tracks.isEmpty())
|
||||
return;
|
||||
|
||||
QRectF br = trackBoundingRect();
|
||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||
|
||||
if (ba.width() < e->size().width()) {
|
||||
qreal diff = e->size().width() - ba.width();
|
||||
ba.adjust(-diff/2, 0, diff/2, 0);
|
||||
}
|
||||
if (ba.height() < e->size().height()) {
|
||||
qreal diff = e->size().height() - ba.height();
|
||||
ba.adjust(0, -diff/2, 0, diff/2);
|
||||
}
|
||||
|
||||
_scene->setSceneRect(ba);
|
||||
|
||||
centerOn(br.center());
|
||||
resetCachedContent();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ private:
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
QGraphicsScene *_scene;
|
||||
QList<QVector<QPointF> > _tracks;
|
||||
|
Loading…
Reference in New Issue
Block a user