27 return QStringLiteral(
"CheckBox" );
49 bool boolValue =
false;
52 const QMetaType::Type fieldType = layer->
fields().
at( fieldIndex ).
type();
53 if ( fieldType == QMetaType::Type::Bool )
57 boolValue = value.toBool();
58 textValue = boolValue ? QObject::tr(
"true" ) : QObject::tr(
"false" );
63 if ( !value.canConvert<QString>() )
66 textValue = QObject::tr(
"(invalid)" );
70 textValue = value.toString();
71 if ( config.contains( QStringLiteral(
"CheckedState" ) ) && textValue == config[ QStringLiteral(
"CheckedState" ) ].toString() )
75 else if ( config.contains( QStringLiteral(
"UncheckedState" ) ) && textValue == config[ QStringLiteral(
"UncheckedState" ) ].toString() )
82 textValue = QStringLiteral(
"(%1)" ).arg( textValue );
93 switch ( displayMethod )
97 return QObject::tr(
"true" );
99 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.