QgsDateTimeFieldFormatter class
Field formatter for a date time field.
Contents
This represents a date, time or datetime value based on the field configuration.
Base classes
- class QgsFieldFormatter
- A field formatter helps to handle and display values for a field.
Public static functions
- static auto defaultFormat(QVariant::Type type) -> QString
- Gets the default format in function of the type.
Constructors, destructors, conversion operators
- QgsDateTimeFieldFormatter() defaulted
- Default constructor of field formatter for a date time field.
Public functions
- auto id() const -> QString override
- Returns a unique id for this field formatter.
- auto representValue(QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value) const -> QString override
- Create a pretty String representation of the value.
Function documentation
static QString QgsDateTimeFieldFormatter:: defaultFormat(QVariant::Type type)
Gets the default format in function of the type.
The type is expected to be one of
- QVariant::DateTime
- QVariant::Date
- QVariant::Time
QString QgsDateTimeFieldFormatter:: id() const override
Returns a unique id for this field formatter.
This id will later be used to identify this field formatter in the registry with QgsFieldFormatterRegistry::
This id matches the id of a QgsEditorWidgetFactory.
QString QgsDateTimeFieldFormatter:: representValue(QgsVectorLayer* layer,
int fieldIndex,
const QVariantMap& config,
const QVariant& cache,
const QVariant& value) const override
Create a pretty String representation of the value.
| Returns | By default the string representation of the provided value as implied by the field definition is returned. |
|---|