26 return QStringLiteral(
"CheckBox" );
48 bool boolValue =
false;
51 const QMetaType::Type fieldType = layer->
fields().
at( fieldIndex ).
type();
52 if ( fieldType == QMetaType::Type::Bool )
56 boolValue = value.toBool();
57 textValue = boolValue ? QObject::tr(
"true" ) : QObject::tr(
"false" );
62 if ( !value.canConvert<QString>() )
65 textValue = QObject::tr(
"(invalid)" );
69 textValue = value.toString();
70 if ( config.contains( QStringLiteral(
"CheckedState" ) ) && textValue == config[ QStringLiteral(
"CheckedState" ) ].toString() )
74 else if ( config.contains( QStringLiteral(
"UncheckedState" ) ) && textValue == config[ QStringLiteral(
"UncheckedState" ) ].toString() )
81 textValue = QStringLiteral(
"(%1)" ).arg( textValue );
92 switch ( displayMethod )
96 return QObject::tr(
"true" );
98 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 data sets.