mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-03 14:52:11 +02:00
Implement map export to image
This commit is contained in:
parent
9aaa8c0d89
commit
dee235ea19
@ -1234,3 +1234,14 @@ void MainWindow::on_actionPaste_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
void saveMap();
|
||||
bool openMap(const QString &);
|
||||
|
||||
MapView * mapView();
|
||||
//MapView * mapView();
|
||||
|
||||
void loadObjectsTree();
|
||||
|
||||
@ -115,6 +115,8 @@ private slots:
|
||||
|
||||
void on_actionPaste_triggered();
|
||||
|
||||
void on_actionExport_triggered();
|
||||
|
||||
public slots:
|
||||
|
||||
void treeViewSelected(const QModelIndex &selected, const QModelIndex &deselected);
|
||||
|
@ -62,6 +62,7 @@
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_as"/>
|
||||
<addaction name="actionExport"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuMap">
|
||||
<property name="title">
|
||||
@ -750,7 +751,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>128</width>
|
||||
<height>257</height>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -793,7 +794,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>128</width>
|
||||
<height>257</height>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -829,7 +830,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>128</width>
|
||||
<height>257</height>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -1228,6 +1229,11 @@
|
||||
<string notr="true">Ctrl+8</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport">
|
||||
<property name="text">
|
||||
<string>Export as</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user