1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Export grabs whole map

This commit is contained in:
nordsoft 2023-04-29 21:33:23 +04:00 committed by Nordsoft91
parent dee235ea19
commit e8a8e893ee

View File

@ -1240,8 +1240,10 @@ void MainWindow::on_actionExport_triggered()
QString fileName = QFileDialog::getSaveFileName(this, "Save to image", QCoreApplication::applicationDirPath(), "BMP (*.bmp);;JPEG (*.jpeg);;PNG (*.png)");
if(!fileName.isNull())
{
auto pixmap = ui->mapView->grab();
pixmap.save(fileName);
QImage image(ui->mapView->scene()->sceneRect().size().toSize(), QImage::Format_RGB888);
QPainter painter(&image);
ui->mapView->scene()->render(&painter);
image.save(fileName);
}
}