mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-10 00:13:55 -04:00
use quotes in hstore list items
This commit is contained in:
parent
5bf300e758
commit
ebfce4f55b
@ -204,6 +204,8 @@ QStringList QgsValueRelationFieldFormatter::valueToStringList( const QVariant &v
|
||||
catch ( json::parse_error &ex )
|
||||
{
|
||||
qDebug() << QString::fromStdString( ex.what() );
|
||||
//fallback for wrongly stored data
|
||||
checkList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( ',' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,24 @@ QVariant QgsValueRelationWidgetWrapper::value() const
|
||||
}
|
||||
else
|
||||
{
|
||||
QStringList sl;
|
||||
for ( const QString &s : qgis::as_const( selection ) )
|
||||
{
|
||||
// Convert to proper type
|
||||
const QVariant::Type type { fkType() };
|
||||
switch ( type )
|
||||
{
|
||||
case QVariant::Type::Int:
|
||||
case QVariant::Type::LongLong:
|
||||
sl.push_back( s );
|
||||
break;
|
||||
default:
|
||||
sl.push_back( "\"" + s + "\"" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
//store as a formatted string because the fields supports only string
|
||||
v = selection.join( ',' ).prepend( '{' ).append( '}' );
|
||||
v = sl.join( ',' ).prepend( '{' ).append( '}' );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user