Skip to content

Commit

Permalink
[composer] Enable always disabled labels as outline checkbox in
Browse files Browse the repository at this point in the history
svg export, hook up to labeling setting
  • Loading branch information
nyalldawson committed Sep 14, 2015
1 parent 4bc606c commit aedf08c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -2303,6 +2303,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QString outputFileName;
QString outputDir;
bool groupLayers = false;
bool prevSettingLabelsAsOutlines = QgsProject::instance()->readBoolEntry( "PAL", "/DrawOutlineLabels", true );

if ( mode == QgsComposer::Single )
{
Expand Down Expand Up @@ -2333,8 +2334,12 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QDialog dialog;
Ui::QgsSvgExportOptionsDialog options;
options.setupUi( &dialog );
options.chkTextAsOutline->setChecked( prevSettingLabelsAsOutlines );

dialog.exec();
groupLayers = options.chkMapLayersAsGroup->isChecked();
//temporarily override label draw outlines setting
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", options.chkTextAsOutline->isChecked() );
}

if ( !outputFileName.endsWith( ".svg", Qt::CaseInsensitive ) )
Expand Down Expand Up @@ -2388,8 +2393,12 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QDialog dialog;
Ui::QgsSvgExportOptionsDialog options;
options.setupUi( &dialog );
options.chkTextAsOutline->setChecked( prevSettingLabelsAsOutlines );

dialog.exec();
groupLayers = options.chkMapLayersAsGroup->isChecked();
//temporarily override label draw outlines setting
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", options.chkTextAsOutline->isChecked() );
}


Expand All @@ -2409,6 +2418,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QMessageBox::Ok,
QMessageBox::Ok );
mView->setPaintingEnabled( true );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", prevSettingLabelsAsOutlines );
return;
}
}
Expand Down Expand Up @@ -2437,6 +2447,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QMessageBox::Ok,
QMessageBox::Ok );
mView->setPaintingEnabled( true );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", prevSettingLabelsAsOutlines );
return;
}
outputFileName = QDir( outputDir ).filePath( atlasMap->currentFilename() ) + ".svg";
Expand Down Expand Up @@ -2481,6 +2492,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QMessageBox::Ok,
QMessageBox::Ok );
mView->setPaintingEnabled( true );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", prevSettingLabelsAsOutlines );
return;
}

Expand Down Expand Up @@ -2604,6 +2616,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QMessageBox::Ok,
QMessageBox::Ok );
mView->setPaintingEnabled( true );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", prevSettingLabelsAsOutlines );
return;
}

Expand All @@ -2618,6 +2631,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
atlasMap->endRender();

mView->setPaintingEnabled( true );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", prevSettingLabelsAsOutlines );
}

void QgsComposer::on_mActionSelectMoveItem_triggered()
Expand Down
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>463</width>
<width>471</width>
<height>103</height>
</rect>
</property>
Expand All @@ -29,10 +29,13 @@
<item>
<widget class="QCheckBox" name="chkTextAsOutline">
<property name="enabled">
<bool>false</bool>
<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>
<property name="text">
<string>Render text as outline</string>
<string>Render map labels as outlines</string>
</property>
<property name="checked">
<bool>true</bool>
Expand Down

0 comments on commit aedf08c

Please sign in to comment.