Skip to content

Commit

Permalink
[needs-docs] Use a combo box in layout SVG settings dialog for text e…
Browse files Browse the repository at this point in the history
…xport format

This makes it match the label engine settings dialog, and opens the possibility
for additional text export modes to be added in future.
  • Loading branch information
nyalldawson committed Dec 11, 2018
1 parent cd8b91b commit 15abbcf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
8 changes: 6 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3998,7 +3998,11 @@ bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExport
QDialog dialog;
Ui::QgsSvgExportOptionsDialog options;
options.setupUi( &dialog );
options.chkTextAsOutline->setChecked( prevTextRenderFormat == QgsRenderContext::TextFormatAlwaysOutlines );

options.mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Paths (Recommended)" ), QgsRenderContext::TextFormatAlwaysOutlines );
options.mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Text Objects" ), QgsRenderContext::TextFormatAlwaysText );

options.mTextRenderFormatComboBox->setCurrentIndex( options.mTextRenderFormatComboBox->findData( prevTextRenderFormat ) );
options.chkMapLayersAsGroup->setChecked( layersAsGroup );
options.mClipToContentGroupBox->setChecked( cropToContents );
options.mForceVectorCheckBox->setChecked( previousForceVector );
Expand All @@ -4018,7 +4022,7 @@ bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExport
marginBottom = options.mBottomMarginSpinBox->value();
marginLeft = options.mLeftMarginSpinBox->value();
includeMetadata = options.mIncludeMetadataCheckbox->isChecked();
QgsRenderContext::TextRenderFormat textRenderFormat = options.chkTextAsOutline->isChecked() ? QgsRenderContext::TextFormatAlwaysOutlines : QgsRenderContext::TextFormatAlwaysText;
QgsRenderContext::TextRenderFormat textRenderFormat = static_cast< QgsRenderContext::TextRenderFormat >( options.mTextRenderFormatComboBox->currentData().toInt() );

if ( mLayout )
{
Expand Down
28 changes: 11 additions & 17 deletions src/ui/layout/qgssvgexportoptions.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<property name="title">
<string>SVG Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="chkMapLayersAsGroup">
<property name="text">
<string>Export map layers as SVG groups (may affect label placement)</string>
Expand All @@ -30,23 +30,17 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkTextAsOutline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Uncheck to render map labels as text objects. This will degrade the quality of the map labels but allow editing in vector illustration software.</string>
</property>
<item row="3" column="1">
<widget class="QComboBox" name="mTextRenderFormatComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Render map labels as outlines</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Text export</string>
</property>
</widget>
</item>
<item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="mForceVectorCheckBox">
<property name="toolTip">
<string>If checked, the layout will always be kept as vector objects when exported to a compatible format, even if the appearance of the resultant file does not match the layouts settings. If unchecked, some elements in the layout may be rasterized in order to keep their appearance intact.</string>
Expand All @@ -56,7 +50,7 @@
</property>
</widget>
</item>
<item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="mIncludeMetadataCheckbox">
<property name="text">
<string>Export RDF metadata</string>
Expand Down Expand Up @@ -214,9 +208,9 @@
</customwidgets>
<tabstops>
<tabstop>chkMapLayersAsGroup</tabstop>
<tabstop>chkTextAsOutline</tabstop>
<tabstop>mForceVectorCheckBox</tabstop>
<tabstop>mIncludeMetadataCheckbox</tabstop>
<tabstop>mTextRenderFormatComboBox</tabstop>
<tabstop>mClipToContentGroupBox</tabstop>
<tabstop>mTopMarginSpinBox</tabstop>
<tabstop>mLeftMarginSpinBox</tabstop>
Expand Down

0 comments on commit 15abbcf

Please sign in to comment.