25 setFlags(
flags() | QgsFieldFormatter::CanProvideAvailableValues );
30 return QStringLiteral(
"ValueMap" );
37 QString valueInternalText;
41 valueInternalText = value.toString();
43 const QVariant v = config.value( QStringLiteral(
"map" ) );
44 const QVariantList list = v.toList();
47 for (
const QVariant &item : list )
49 const QVariantMap map = item.toMap();
51 for (
auto it = map.constBegin(); it != map.constEnd(); ++it )
53 if ( it.value().toString() == valueInternalText )
62 const QVariantMap map = v.toMap();
63 return map.key( valueInternalText, QVariant( QStringLiteral(
"(%1)" ).arg( layer->
fields().
at( fieldIndex ).
displayString( value ) ) ).toString() );
77 const QList<QVariant> valueList = config.value( QStringLiteral(
"map" ) ).toList();
78 for (
const QVariant &item : valueList )
80 values.append( item.toMap().constBegin().value() );
81 if ( values.count() == countLimit )
A context for field formatter containing information like the project.
QString displayString(const QVariant &v) const
Formats string for display.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
Represents a vector layer which manages a vector based data sets.