@@ -115,39 +115,48 @@ QList<QPair<QLabel*, QWidget*> > QgsVectorLayerSaveAsDialog::createControls( con
115
115
{
116
116
case QgsVectorFileWriter::Int:
117
117
{
118
- QgsVectorFileWriter::IntOption* opt = dynamic_cast <QgsVectorFileWriter::IntOption*>( option );
119
- QSpinBox* sb = new QSpinBox ();
120
- sb->setObjectName ( it.key () );
121
- sb->setValue ( opt->defaultValue );
122
- control = sb;
118
+ QgsVectorFileWriter::IntOption *opt = dynamic_cast <QgsVectorFileWriter::IntOption*>( option );
119
+ if ( opt )
120
+ {
121
+ QSpinBox *sb = new QSpinBox ();
122
+ sb->setObjectName ( it.key () );
123
+ sb->setValue ( opt->defaultValue );
124
+ control = sb;
125
+ }
123
126
break ;
124
127
}
125
128
126
129
case QgsVectorFileWriter::Set:
127
130
{
128
- QgsVectorFileWriter::SetOption* opt = dynamic_cast <QgsVectorFileWriter::SetOption*>( option );
129
- QComboBox* cb = new QComboBox ();
130
- cb->setObjectName ( it.key () );
131
- Q_FOREACH ( const QString& val, opt->values )
131
+ QgsVectorFileWriter::SetOption *opt = dynamic_cast <QgsVectorFileWriter::SetOption*>( option );
132
+ if ( opt )
132
133
{
133
- cb->addItem ( val, val );
134
+ QComboBox* cb = new QComboBox ();
135
+ cb->setObjectName ( it.key () );
136
+ Q_FOREACH ( const QString& val, opt->values )
137
+ {
138
+ cb->addItem ( val, val );
139
+ }
140
+ if ( opt->allowNone )
141
+ cb->addItem ( tr ( " <Default>" ), QVariant ( QVariant::String ) );
142
+ int idx = cb->findText ( opt->defaultValue );
143
+ if ( idx == -1 )
144
+ idx = cb->findData ( QVariant ( QVariant::String ) );
145
+ cb->setCurrentIndex ( idx );
146
+ control = cb;
134
147
}
135
- if ( opt->allowNone )
136
- cb->addItem ( tr ( " <Default>" ), QVariant ( QVariant::String ) );
137
- int idx = cb->findText ( opt->defaultValue );
138
- if ( idx == -1 )
139
- idx = cb->findData ( QVariant ( QVariant::String ) );
140
- cb->setCurrentIndex ( idx );
141
- control = cb;
142
148
break ;
143
149
}
144
150
145
151
case QgsVectorFileWriter::String:
146
152
{
147
- QgsVectorFileWriter::StringOption* opt = dynamic_cast <QgsVectorFileWriter::StringOption*>( option );
148
- QLineEdit* le = new QLineEdit ( opt->defaultValue );
149
- le->setObjectName ( it.key () );
150
- control = le;
153
+ QgsVectorFileWriter::StringOption *opt = dynamic_cast <QgsVectorFileWriter::StringOption*>( option );
154
+ if ( opt )
155
+ {
156
+ QLineEdit* le = new QLineEdit ( opt->defaultValue );
157
+ le->setObjectName ( it.key () );
158
+ control = le;
159
+ }
151
160
break ;
152
161
}
153
162
0 commit comments