26 return QStringLiteral(
"CheckBox" );
48 bool boolValue =
false;
51 const QVariant::Type fieldType = layer->
fields().
at( fieldIndex ).
type();
52 if ( fieldType == QVariant::Bool )
54 boolValue = value.toBool();
55 textValue = boolValue ? QObject::tr(
"true" ) : QObject::tr(
"false" );
59 if ( !value.canConvert<QString>() )
62 textValue = QObject::tr(
"(invalid)" );
66 textValue = value.toString();
67 if ( config.contains( QStringLiteral(
"CheckedState" ) ) && textValue == config[ QStringLiteral(
"CheckedState" ) ].toString() )
71 else if ( config.contains( QStringLiteral(
"UncheckedState" ) ) && textValue == config[ QStringLiteral(
"UncheckedState" ) ].toString() )
78 textValue = QStringLiteral(
"(%1)" ).arg( textValue );
89 switch ( displayMethod )
93 return QObject::tr(
"true" );
95 return QObject::tr(
"false" );
static QString nullRepresentation()
This string is 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)
Returns true if the specified variant should be considered a NULL value.
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.