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 bool showTimeZone =
false;
55 if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDate )
57 date = value.toDateTime();
59 else if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDateTime )
61 date = value.toDateTime();
65 else if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QTime )
67 return value.toTime().toString( displayFormat );
73 date = QDateTime::fromString( value.toString(), Qt::ISODate );
77 date = QDateTime::fromString( value.toString(), fieldFormat );
86 result = QStringLiteral(
"%1 (%2)" ).arg( date.toString( displayFormat ), date.timeZoneAbbreviation() );
90 result = date.toString( displayFormat );
95 result = value.toString();
105 case QVariant::DateTime:
116 QString dateFormat = QLocale().dateFormat( QLocale::FormatType::ShortFormat );
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.