@@ -347,7 +347,7 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
347
347
bool fieldsAsDisplayedValues = false ;
348
348
349
349
const QString sFormat ( format () );
350
- if ( sFormat == QLatin1String ( " DXF" ) )
350
+ if ( sFormat == QLatin1String ( " DXF" ) || sFormat == QLatin1String ( " DGN " ) )
351
351
{
352
352
mAttributesSelection ->setEnabled ( false );
353
353
selectAllFields = false ;
@@ -686,24 +686,27 @@ QStringList QgsVectorLayerSaveAsDialog::datasourceOptions() const
686
686
{
687
687
case QgsVectorFileWriter::Int:
688
688
{
689
+ QgsVectorFileWriter::IntOption *opt = dynamic_cast <QgsVectorFileWriter::IntOption *>( *it );
689
690
QSpinBox *sb = mDatasourceOptionsGroupBox ->findChild <QSpinBox *>( it.key () );
690
- if ( sb )
691
+ if ( opt && sb && sb-> value () != opt-> defaultValue )
691
692
options << QStringLiteral ( " %1=%2" ).arg ( it.key () ).arg ( sb->value () );
692
693
break ;
693
694
}
694
695
695
696
case QgsVectorFileWriter::Set:
696
697
{
698
+ QgsVectorFileWriter::SetOption *opt = dynamic_cast <QgsVectorFileWriter::SetOption *>( *it );
697
699
QComboBox *cb = mDatasourceOptionsGroupBox ->findChild <QComboBox *>( it.key () );
698
- if ( cb && ! cb->currentData (). isNull () )
700
+ if ( opt && cb && cb->itemData ( cb-> currentIndex () ) != opt-> defaultValue )
699
701
options << QStringLiteral ( " %1=%2" ).arg ( it.key (), cb->currentText () );
700
702
break ;
701
703
}
702
704
703
705
case QgsVectorFileWriter::String:
704
706
{
707
+ QgsVectorFileWriter::StringOption *opt = dynamic_cast <QgsVectorFileWriter::StringOption *>( *it );
705
708
QLineEdit *le = mDatasourceOptionsGroupBox ->findChild <QLineEdit *>( it.key () );
706
- if ( le )
709
+ if ( opt && le && le-> text () != opt-> defaultValue )
707
710
options << QStringLiteral ( " %1=%2" ).arg ( it.key (), le->text () );
708
711
break ;
709
712
}
@@ -738,24 +741,26 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
738
741
{
739
742
case QgsVectorFileWriter::Int:
740
743
{
744
+ QgsVectorFileWriter::IntOption *opt = dynamic_cast <QgsVectorFileWriter::IntOption *>( *it );
741
745
QSpinBox *sb = mLayerOptionsGroupBox ->findChild <QSpinBox *>( it.key () );
742
- if ( sb )
743
- options << QStringLiteral ( " %1=%2" ).arg ( it.key () ).arg ( sb->value () );
Collapse comment Comment on line R743
@jef-n was this line dropped accidentally?
yes. it was removed accidentally. Re-added in fc7ac83 . But in 2.18 it was still there, so the tickets - contrary to the commit what the commit message says - are unrelated to that line. QGIS' default settings probably don't match OGR's - in that case it's still this commit.
Code has comments. Press enter to view. 744
- break ;
746
+ if ( opt && sb && sb->value () != opt->defaultValue )
747
+ break ;
745
748
}
746
749
747
750
case QgsVectorFileWriter::Set:
748
751
{
752
+ QgsVectorFileWriter::SetOption *opt = dynamic_cast <QgsVectorFileWriter::SetOption *>( *it );
749
753
QComboBox *cb = mLayerOptionsGroupBox ->findChild <QComboBox *>( it.key () );
750
- if ( cb && ! cb->currentData (). isNull () )
754
+ if ( opt && cb && cb->itemData ( cb-> currentIndex () ) != opt-> defaultValue )
751
755
options << QStringLiteral ( " %1=%2" ).arg ( it.key (), cb->currentText () );
752
756
break ;
753
757
}
754
758
755
759
case QgsVectorFileWriter::String:
756
760
{
761
+ QgsVectorFileWriter::StringOption *opt = dynamic_cast <QgsVectorFileWriter::StringOption *>( *it );
757
762
QLineEdit *le = mLayerOptionsGroupBox ->findChild <QLineEdit *>( it.key () );
758
- if ( le && ! le->text (). isEmpty () )
763
+ if ( opt && le && le->text () != opt-> defaultValue )
759
764
options << QStringLiteral ( " %1=%2" ).arg ( it.key (), le->text () );
760
765
break ;
761
766
}
0 commit comments