File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,19 @@ void QgsFieldExpressionWidget::setField( const QString &fieldName )
124
124
QModelIndex idx = mFieldProxyModel ->sourceFieldModel ()->indexFromName ( fieldName );
125
125
if ( !idx.isValid () )
126
126
{
127
- // new expression
128
- idx = mFieldProxyModel ->sourceFieldModel ()->setExpression ( fieldName );
127
+ // try to remove quotes and white spaces
128
+ QString simpleFieldName = fieldName.trimmed ();
129
+ if ( simpleFieldName.startsWith ( ' "' ) && simpleFieldName.endsWith ( ' "' ) )
130
+ {
131
+ simpleFieldName.remove ( 0 , 1 ).chop ( 1 );
132
+ idx = mFieldProxyModel ->sourceFieldModel ()->indexFromName ( simpleFieldName );
133
+ }
134
+
135
+ if ( !idx.isValid () )
136
+ {
137
+ // new expression
138
+ idx = mFieldProxyModel ->sourceFieldModel ()->setExpression ( fieldName );
139
+ }
129
140
}
130
141
QModelIndex proxyIndex = mFieldProxyModel ->mapFromSource ( idx );
131
142
mCombo ->setCurrentIndex ( proxyIndex.row () );
You can’t perform that action at this time.
0 commit comments