mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Address PR comments (minor changes)
This commit is contained in:
parent
564fd50e43
commit
3f1ba81b7e
@ -59,7 +59,7 @@ Constructor for QgsValueRelationFieldFormatter.
|
||||
|
||||
static QStringList valueToStringList( const QVariant &value );
|
||||
%Docstring
|
||||
Utility to convert an array or a string representation of an (C style: {1,2...}) array in the form ``value`` to a string list
|
||||
Utility to convert a list or a string representation of an (hstore style: {1,2...}) list in ``value`` to a string list
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
@ -168,10 +168,6 @@ QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatte
|
||||
|
||||
QStringList QgsValueRelationFieldFormatter::valueToStringList( const QVariant &value )
|
||||
{
|
||||
// Note: the recommended way to pass a value is QVariant::StringList but
|
||||
// for back compatibility a string representation either in the form
|
||||
// of a JSON array or in the form of {"quoted_str", 1, ... } is
|
||||
// also accepted
|
||||
QStringList checkList;
|
||||
if ( value.type() == QVariant::StringList )
|
||||
{
|
||||
@ -183,7 +179,7 @@ QStringList QgsValueRelationFieldFormatter::valueToStringList( const QVariant &v
|
||||
auto newVal { value };
|
||||
if ( newVal.toString().trimmed().startsWith( '{' ) )
|
||||
{
|
||||
newVal = QVariant( newVal.toString().trimmed().mid( 1 ).chopped( 1 ).prepend( '[' ).append( ']' ) );
|
||||
newVal = QVariant( newVal.toString().trimmed().mid( 1 ).mid( 0, newVal.toString().length() - 2 ).prepend( '[' ).append( ']' ) );
|
||||
}
|
||||
if ( newVal.toString().trimmed().startsWith( '[' ) )
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ class CORE_EXPORT QgsValueRelationFieldFormatter : public QgsFieldFormatter
|
||||
QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const override;
|
||||
|
||||
/**
|
||||
* Utility to convert an array or a string representation of an (C style: {1,2...}) array in the form \a value to a string list
|
||||
* Utility to convert a list or a string representation of an (hstore style: {1,2...}) list in \a value to a string list
|
||||
* \since QGIS 3.2
|
||||
*/
|
||||
static QStringList valueToStringList( const QVariant &value );
|
||||
|
Loading…
x
Reference in New Issue
Block a user