Skip to content

Commit b121a2f

Browse files
committed
apply #6281
1 parent 14cad93 commit b121a2f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/gui/qgsattributeeditor.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
192192

193193
case QgsVectorLayer::ValueRelation:
194194
{
195-
QSettings settings;
196-
QString nullValue = settings.value( "qgis/nullValue", "NULL" ).toString();
197-
198195
const QgsVectorLayer::ValueRelationData &data = vl->valueRelation( idx );
199196

200197
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( data.mLayer ) );
@@ -209,9 +206,6 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
209206
if ( !data.mFilterAttributeColumn.isNull() )
210207
fi = layer->fieldNameIndex( data.mFilterAttributeColumn );
211208

212-
if ( data.mAllowNull )
213-
map.insert( nullValue, tr( "(no selection)" ) );
214-
215209
if ( ki >= 0 && vi >= 0 )
216210
{
217211
QgsAttributeList attributes;
@@ -236,6 +230,12 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
236230
QComboBox *cb = comboBox( editor, parent );
237231
if ( cb )
238232
{
233+
if ( data.mAllowNull )
234+
{
235+
QSettings settings;
236+
cb->addItem( tr( "(no selection)" ), settings.value( "qgis/nullValue", "NULL" ).toString() );
237+
}
238+
239239
for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
240240
{
241241
if ( data.mOrderByValue )

0 commit comments

Comments
 (0)