18 #include "qgssettings.h"
34 return QStringLiteral(
"DateTime" );
49 const bool fieldIsoFormat = config.value( QStringLiteral(
"field_iso_format" ),
false ).toBool();
50 const QString fieldFormat = config.value( QStringLiteral(
"field_format" ),
defaultFormat(
field.
type() ) ).toString();
51 const QString displayFormat = config.value( QStringLiteral(
"display_format" ),
defaultFormat(
field.
type() ) ).toString();
54 if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDate ||
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDateTime )
56 date = value.toDateTime();
62 date = QDateTime::fromString( value.toString(), Qt::ISODate );
66 date = QDateTime::fromString( value.toString(), fieldFormat );
72 result = date.toString( displayFormat );
76 result = value.toString();
86 case QVariant::DateTime:
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
Encapsulate a field in an attribute table or data source.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.