Skip to content
Permalink
Browse files

[Server][WFS] Use editor widget setup for Range fields

  • Loading branch information
rldhont committed Sep 26, 2018
1 parent 37c1e23 commit 68ba7546173f5de0a2157ce377b7caf6d40f1b6d
@@ -323,6 +323,24 @@ namespace QgsWfs
else
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "dateTime" ) );
}
else if ( setup.type() == QStringLiteral( "Range" ) )
{
const QVariantMap config = setup.config();
if ( config.contains( QStringLiteral( "Precision" ) ) )
{
// if precision in range config is not the same as the attributePrec
// we need to update type
bool ok;
int configPrec( config[ QStringLiteral( "Precision" ) ].toInt( &ok ) );
if ( ok && configPrec != field.precision() )
{
if ( configPrec == 0 )
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "integer" ) );
else
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "decimal" ) );
}
}
}

sequenceElem.appendChild( attElem );

@@ -1467,6 +1467,18 @@ namespace QgsWfs
return date.toString( fieldFormat );
}
}
else if ( setup.type() == QStringLiteral( "Range" ) )
{
const QVariantMap config = setup.config();
if ( config.contains( QStringLiteral( "Precision" ) ) )
{
// if precision is defined, use it
bool ok;
int precision( config[ QStringLiteral( "Precision" ) ].toInt( &ok ) );
if ( ok )
return QString::number( value.toDouble(), 'f', precision );
}
}

switch ( value.type() )
{

0 comments on commit 68ba754

Please sign in to comment.
You can’t perform that action at this time.