34 return QStringLiteral(
"DateTime" );
48 if ( fieldIndex < 0 || fieldIndex >= layer->
fields().
size() )
50 return value.toString();
54 const bool fieldIsoFormat = config.value( QStringLiteral(
"field_iso_format" ),
false ).toBool();
55 const QString fieldFormat = config.value( QStringLiteral(
"field_format" ),
defaultFormat(
field.
type() ) ).toString();
56 const QString displayFormat = config.value( QStringLiteral(
"display_format" ),
defaultFormat(
field.
type() ) ).toString();
59 bool showTimeZone =
false;
60 if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDate )
62 date = value.toDateTime();
64 else if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QDateTime )
66 date = value.toDateTime();
70 else if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::QTime )
72 return value.toTime().toString( displayFormat );
78 date = QDateTime::fromString( value.toString(), Qt::ISODate );
82 date = QDateTime::fromString( value.toString(), fieldFormat );
91 result = QStringLiteral(
"%1 (%2)" ).arg( date.toString( displayFormat ), date.timeZoneAbbreviation() );
95 result = date.toString( displayFormat );
100 result = value.toString();
110 case QVariant::DateTime:
121 QString dateFormat = QLocale().dateFormat( QLocale::FormatType::ShortFormat );