26using namespace Qt::StringLiterals;
52 bool boolValue =
false;
55 const QMetaType::Type fieldType = layer->
fields().
at( fieldIndex ).
type();
56 if ( fieldType == QMetaType::Type::Bool )
60 boolValue = value.toBool();
61 textValue = boolValue ? QObject::tr(
"true" ) : QObject::tr(
"false" );
66 if ( !value.canConvert<QString>() )
69 textValue = QObject::tr(
"(invalid)" );
73 textValue = value.toString();
74 if ( config.contains( u
"CheckedState"_s ) && textValue == config[ u
"CheckedState"_s ].toString() )
78 else if ( config.contains( u
"UncheckedState"_s ) && textValue == config[ u
"UncheckedState"_s ].toString() )
85 textValue = u
"(%1)"_s.arg( textValue );
96 switch ( displayMethod )
100 return QObject::tr(
"true" );
102 return QObject::tr(
"false" );
static QString nullRepresentation()
Returns the string used to represent the value NULL throughout QGIS.
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 dataset.