diff -r c542f6e3a133 -r 19596777eb7a QTfrontend/ui/widget/drawmapwidget.cpp --- a/QTfrontend/ui/widget/drawmapwidget.cpp Tue Jun 04 22:08:17 2013 +0200 +++ b/QTfrontend/ui/widget/drawmapwidget.cpp Wed Jun 05 14:00:29 2013 +0200 @@ -62,8 +62,43 @@ { Q_UNUSED(event); + int height = this->height(); + int width = this->width(); + + if ((m_scene->height() > 0) && (m_scene->width() > 0) && (height > 0)) + { + qreal saspect = m_scene->width() / m_scene->height(); + + qreal h = height; + qreal w = width; + qreal waspect = w / h; + + if (waspect < saspect) + { + h = w / saspect; + } + else if (waspect > saspect) + { + w = saspect * h; + } + + int fixedh = (int)h; + int fixedw = (int)w; + + if (ui->graphicsView->width() != fixedw) + { + ui->graphicsView->setFixedWidth(fixedw); + } + + if (ui->graphicsView->height() != fixedh) + { + ui->graphicsView->setFixedHeight(fixedh); + } + + } + if(ui->graphicsView && ui->graphicsView->scene()) - ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio); + ui->graphicsView->fitInView(m_scene->sceneRect(), Qt::KeepAspectRatio); } void DrawMapWidget::showEvent(QShowEvent * event)