diff --git a/forms/mapimageexporter.ui b/forms/mapimageexporter.ui index aa0f3d2d..d82ce2fa 100644 --- a/forms/mapimageexporter.ui +++ b/forms/mapimageexporter.ui @@ -33,7 +33,7 @@ 0 0 - 337 + 373 334 @@ -123,33 +123,20 @@ - + Map - + QComboBox::AdjustToContents - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -275,6 +262,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/src/ui/mapimageexporter.cpp b/src/ui/mapimageexporter.cpp index 4e3b6e05..af7e180c 100644 --- a/src/ui/mapimageexporter.cpp +++ b/src/ui/mapimageexporter.cpp @@ -23,6 +23,7 @@ MapImageExporter::MapImageExporter(QWidget *parent_, Editor *editor_) : } MapImageExporter::~MapImageExporter() { + delete scene; delete ui; } @@ -31,7 +32,7 @@ void MapImageExporter::saveImage() { QString filepath = QFileDialog::getSaveFileName(this, "Export Map Image", defaultFilepath, "Image Files (*.png *.jpg *.bmp)"); if (!filepath.isEmpty()) { - this->ui->graphicsView_Preview->grab(this->ui->graphicsView_Preview->sceneRect().toRect()).save(filepath); + this->preview.save(filepath); this->close(); } } @@ -67,8 +68,8 @@ void MapImageExporter::updatePreview() { // draw map border // note: this will break when allowing map to be selected from drop down maybe int borderHeight = 0, borderWidth = 0; - if (showUpConnections || showDownConnections || showLeftConnections || showRightConnections) showBorder = true; - if (showBorder) { + bool forceDrawBorder = showUpConnections || showDownConnections || showLeftConnections || showRightConnections; + if (showBorder || forceDrawBorder) { borderHeight = 32 * 3, borderWidth = 32 * 3; QPixmap newPreview = QPixmap(map->pixmap.width() + borderWidth * 2, map->pixmap.height() + borderHeight * 2); QPainter borderPainter(&newPreview);