Skip to content

Commit

Permalink
Show literal defaults in add feature form
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 7, 2016
1 parent b0bd61f commit 94413c3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgsfeatureaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,17 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap& defaultAttributes, boo
}
else
{
v = provider->defaultValueClause( idx );
QVariant defaultLiteral = mLayer->dataProvider()->defaultValue( idx );
if ( defaultLiteral.isValid() )
{
v = defaultLiteral;
}
else
{
QString defaultClause = provider->defaultValueClause( idx );
if ( !defaultClause.isEmpty() )
v = defaultClause;
}
}

mFeature->setAttribute( idx, v );
Expand Down

0 comments on commit 94413c3

Please sign in to comment.