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