Skip to content

Commit 0f9aaf4

Browse files
committedDec 17, 2017
Expose world file option in image settings dialog
1 parent 953d2c4 commit 0f9aaf4

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed
 

‎src/app/layout/qgslayoutdesignerdialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,7 @@ void QgsLayoutDesignerDialog::exportToRaster()
14561456
imageDlg.setResolution( dpi );
14571457
imageDlg.setCropToContents( cropToContents );
14581458
imageDlg.setCropMargins( marginTop, marginRight, marginBottom, marginLeft );
1459+
imageDlg.setGenerateWorldFile( mLayout->customProperty( QStringLiteral( "exportWorldFile" ), false ).toBool() );
14591460

14601461
#if 0 //TODO
14611462
QgsAtlasComposition *atlasMap = &mComposition->atlasComposition();
@@ -1505,7 +1506,7 @@ void QgsLayoutDesignerDialog::exportToRaster()
15051506
{
15061507
settings.imageSize = QSize( imageDlg.imageWidth(), imageDlg.imageHeight() );
15071508
}
1508-
settings.generateWorldFile = mLayout->customProperty( QStringLiteral( "exportWorldFile" ), false ).toBool();
1509+
settings.generateWorldFile = imageDlg.generateWorldFile();
15091510

15101511
switch ( exporter.exportToImage( fileNExt.first, settings ) )
15111512
{

‎src/app/layout/qgslayoutimageexportoptionsdialog.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ bool QgsLayoutImageExportOptionsDialog::cropToContents() const
9595
return mClipToContentGroupBox->isChecked();
9696
}
9797

98+
void QgsLayoutImageExportOptionsDialog::setGenerateWorldFile( bool generate )
99+
{
100+
mGenerateWorldFile->setChecked( generate );
101+
}
102+
103+
bool QgsLayoutImageExportOptionsDialog::generateWorldFile() const
104+
{
105+
return mGenerateWorldFile->isChecked();
106+
}
107+
98108
void QgsLayoutImageExportOptionsDialog::getCropMargins( int &topMargin, int &rightMargin, int &bottomMargin, int &leftMargin ) const
99109
{
100110
topMargin = mTopMarginSpinBox->value();

‎src/app/layout/qgslayoutimageexportoptionsdialog.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ class QgsLayoutImageExportOptionsDialog: public QDialog, private Ui::QgsLayoutIm
8484
*/
8585
bool cropToContents() const;
8686

87+
/**
88+
* Sets whether the generate world file option should be checked.
89+
* \see generateWorldFile()
90+
*/
91+
void setGenerateWorldFile( bool generate );
92+
93+
/**
94+
* Returns whether the generate world file option is checked in the dialog.
95+
* \see setGenerateWorldFile()
96+
*/
97+
bool generateWorldFile() const;
98+
8799
/**
88100
* Fetches the current crop to contents margin values, in pixels.
89101
* \param topMargin destination for top margin

‎src/ui/layout/qgslayoutimageexportoptions.ui

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>533</width>
10-
<height>651</height>
10+
<height>394</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -234,6 +234,16 @@
234234
</layout>
235235
</widget>
236236
</item>
237+
<item>
238+
<widget class="QCheckBox" name="mGenerateWorldFile">
239+
<property name="toolTip">
240+
<string>If checked, a separate world file which georeferences exported images will be created</string>
241+
</property>
242+
<property name="text">
243+
<string>Generate world file</string>
244+
</property>
245+
</widget>
246+
</item>
237247
<item>
238248
<spacer name="verticalSpacer">
239249
<property name="orientation">

0 commit comments

Comments
 (0)
Please sign in to comment.