@@ -347,7 +347,7 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
347347 bool fieldsAsDisplayedValues = false ;
348348
349349 const QString sFormat ( format () );
350- if ( sFormat == QLatin1String ( " DXF" ) )
350+ if ( sFormat == QLatin1String ( " DXF" ) || sFormat == QLatin1String ( " DGN " ) )
351351 {
352352 mAttributesSelection ->setEnabled ( false );
353353 selectAllFields = false ;
@@ -686,24 +686,27 @@ QStringList QgsVectorLayerSaveAsDialog::datasourceOptions() const
686686 {
687687 case QgsVectorFileWriter::Int:
688688 {
689+ QgsVectorFileWriter::IntOption *opt = dynamic_cast <QgsVectorFileWriter::IntOption *>( *it );
689690 QSpinBox *sb = mDatasourceOptionsGroupBox ->findChild <QSpinBox *>( it.key () );
690- if ( sb )
691+ if ( opt && sb && sb-> value () != opt-> defaultValue )
691692 options << QStringLiteral ( " %1=%2" ).arg ( it.key () ).arg ( sb->value () );
692693 break ;
693694 }
694695
695696 case QgsVectorFileWriter::Set:
696697 {
698+ QgsVectorFileWriter::SetOption *opt = dynamic_cast <QgsVectorFileWriter::SetOption *>( *it );
697699 QComboBox *cb = mDatasourceOptionsGroupBox ->findChild <QComboBox *>( it.key () );
698- if ( cb && ! cb->currentData (). isNull () )
700+ if ( opt && cb && cb->itemData ( cb-> currentIndex () ) != opt-> defaultValue )
699701 options << QStringLiteral ( " %1=%2" ).arg ( it.key (), cb->currentText () );
700702 break ;
701703 }
702704
703705 case QgsVectorFileWriter::String:
704706 {
707+ QgsVectorFileWriter::StringOption *opt = dynamic_cast <QgsVectorFileWriter::StringOption *>( *it );
705708 QLineEdit *le = mDatasourceOptionsGroupBox ->findChild <QLineEdit *>( it.key () );
706- if ( le )
709+ if ( opt && le && le-> text () != opt-> defaultValue )
707710 options << QStringLiteral ( " %1=%2" ).arg ( it.key (), le->text () );
708711 break ;
709712 }
@@ -738,24 +741,26 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
738741 {
739742 case QgsVectorFileWriter::Int:
740743 {
744+ QgsVectorFileWriter::IntOption *opt = dynamic_cast <QgsVectorFileWriter::IntOption *>( *it );
741745 QSpinBox *sb = mLayerOptionsGroupBox ->findChild <QSpinBox *>( it.key () );
742- if ( sb )
743- options << QStringLiteral ( " %1=%2" ).arg ( it.key () ).arg ( sb->value () );
744- break ;
746+ if ( opt && sb && sb->value () != opt->defaultValue )
747+ break ;
745748 }
746749
747750 case QgsVectorFileWriter::Set:
748751 {
752+ QgsVectorFileWriter::SetOption *opt = dynamic_cast <QgsVectorFileWriter::SetOption *>( *it );
749753 QComboBox *cb = mLayerOptionsGroupBox ->findChild <QComboBox *>( it.key () );
750- if ( cb && ! cb->currentData (). isNull () )
754+ if ( opt && cb && cb->itemData ( cb-> currentIndex () ) != opt-> defaultValue )
751755 options << QStringLiteral ( " %1=%2" ).arg ( it.key (), cb->currentText () );
752756 break ;
753757 }
754758
755759 case QgsVectorFileWriter::String:
756760 {
761+ QgsVectorFileWriter::StringOption *opt = dynamic_cast <QgsVectorFileWriter::StringOption *>( *it );
757762 QLineEdit *le = mLayerOptionsGroupBox ->findChild <QLineEdit *>( it.key () );
758- if ( le && ! le->text (). isEmpty () )
763+ if ( opt && le && le->text () != opt-> defaultValue )
759764 options << QStringLiteral ( " %1=%2" ).arg ( it.key (), le->text () );
760765 break ;
761766 }
0 commit comments