Skip to content

Commit

Permalink
use scale widget in dxf export
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 9, 2015
1 parent d9280b1 commit db88b01
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/app/qgsdxfexportdialog.cpp
Expand Up @@ -362,7 +362,8 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
QSettings s;
mSymbologyModeComboBox->setCurrentIndex( s.value( "qgis/lastDxfSymbologyMode", "2" ).toInt() );
//last symbol scale
mSymbologyScaleLineEdit->setText( s.value( "qgis/lastSymbologyExportScale", "50000" ).toString() );
mScaleWidget->setMapCanvas( QgisApp::instance()->mapCanvas() );
mScaleWidget->setScale( s.value( "qgis/lastSymbologyExportScale", "1/50000" ).toDouble() );
mMapExtentCheckBox->setChecked( s.value( "qgis/lastDxfMapRectangle", "false" ).toBool() );

QStringList ids = QgsVisibilityPresets::instance()->presets();
Expand Down Expand Up @@ -437,7 +438,7 @@ QList< QPair<QgsVectorLayer *, int> > QgsDxfExportDialog::layers() const

double QgsDxfExportDialog::symbologyScale() const
{
double scale = mSymbologyScaleLineEdit->text().toDouble();
double scale = mScaleWidget->scale();
if ( qgsDoubleNear( scale, 0.0 ) )
{
return 1.0;
Expand Down Expand Up @@ -499,6 +500,6 @@ void QgsDxfExportDialog::saveSettings()
QFileInfo dxfFileInfo( mFileLineEdit->text() );
s.setValue( "qgis/lastDxfDir", dxfFileInfo.absolutePath() );
s.setValue( "qgis/lastDxfSymbologyMode", mSymbologyModeComboBox->currentIndex() );
s.setValue( "qgis/lastSymbologyExportScale", mSymbologyScaleLineEdit->text() );
s.setValue( "qgis/lastSymbologyExportScale", mScaleWidget->scale() );
s.setValue( "qgis/lastDxfMapRectangle", mMapExtentCheckBox->isChecked() );
}
33 changes: 21 additions & 12 deletions src/ui/qgsdxfexportdialogbase.ui
Expand Up @@ -6,14 +6,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>406</width>
<height>433</height>
<width>394</width>
<height>534</height>
</rect>
</property>
<property name="windowTitle">
<string>DXF export</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QLabel" name="mSymbologyScaleLabel">
<property name="text">
<string>Symbology scale</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="mFileSelectionButton">
<property name="text">
Expand All @@ -31,23 +38,13 @@
</attribute>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="mSymbologyScaleLineEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mSaveAsLabel">
<property name="text">
<string>Save as</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mSymbologyScaleLabel">
<property name="text">
<string>Symbology scale</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="mSymbologyModeComboBox">
<item>
Expand Down Expand Up @@ -135,9 +132,21 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QgsScaleWidget" name="mScaleWidget">
<property name="showCurrentScaleButton">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsScaleWidget</class>
<extends>QWidget</extends>
<header>qgsscalewidget.h</header>
</customwidget>
<customwidget>
<class>QgsLayerTreeView</class>
<extends>QTreeView</extends>
Expand Down

0 comments on commit db88b01

Please sign in to comment.