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:
parent
dee235ea19
commit
e8a8e893ee
@ -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)");
|
QString fileName = QFileDialog::getSaveFileName(this, "Save to image", QCoreApplication::applicationDirPath(), "BMP (*.bmp);;JPEG (*.jpeg);;PNG (*.png)");
|
||||||
if(!fileName.isNull())
|
if(!fileName.isNull())
|
||||||
{
|
{
|
||||||
auto pixmap = ui->mapView->grab();
|
QImage image(ui->mapView->scene()->sceneRect().size().toSize(), QImage::Format_RGB888);
|
||||||
pixmap.save(fileName);
|
QPainter painter(&image);
|
||||||
|
ui->mapView->scene()->render(&painter);
|
||||||
|
image.save(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user