23 : mUseAbsoluteTime( false )
24 , mRelativeTimeOffsetHours( relativeTimeOffsetHours )
25 , mRelativeTimeFormat( relativeTimeFormat )
29 : mUseAbsoluteTime( true )
30 , mAbsoluteTimeReferenceTime( absoluteTimeReferenceTime )
31 , mAbsoluteTimeFormat( absoluteTimeFormat )
37 QDomElement elem = doc.createElement( QStringLiteral(
"mesh-time-settings" ) );
38 elem.setAttribute( QStringLiteral(
"use-absolute-time" ), mUseAbsoluteTime ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
39 elem.setAttribute( QStringLiteral(
"relative-time-offset-hours" ), mRelativeTimeOffsetHours );
40 elem.setAttribute( QStringLiteral(
"relative-time-format" ), mRelativeTimeFormat );
41 elem.setAttribute( QStringLiteral(
"absolute-time-reference-time" ), mAbsoluteTimeReferenceTime.toString() );
42 elem.setAttribute( QStringLiteral(
"absolute-time-format" ), mAbsoluteTimeFormat );
49 mUseAbsoluteTime = elem.attribute( QStringLiteral(
"use-absolute-time" ) ).toInt();
50 mRelativeTimeOffsetHours = elem.attribute( QStringLiteral(
"relative-time-offset-hours" ) ).toDouble();
51 mRelativeTimeFormat = elem.attribute( QStringLiteral(
"relative-time-format" ) );
52 mAbsoluteTimeReferenceTime = QDateTime::fromString( elem.attribute( QStringLiteral(
"absolute-time-reference-time" ) ) );
53 mAbsoluteTimeFormat = elem.attribute( QStringLiteral(
"absolute-time-format" ) );
58 return mUseAbsoluteTime;
69 return mRelativeTimeOffsetHours;
79 return mRelativeTimeFormat;
89 return mAbsoluteTimeReferenceTime;
99 return mAbsoluteTimeFormat;
void setRelativeTimeFormat(const QString &relativeTimeFormat)
Sets format used for relative time.
The class is used as a container of context for various read/write operations on other objects...
void setUseAbsoluteTime(bool useAbsoluteTime)
Sets use absolute time flag.
QgsMeshTimeSettings()
Default constructor for relative time formate and 0 offset.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads configuration from the given DOM element.
void setAbsoluteTimeFormat(const QString &absoluteTimeFormat)
Sets format used for absolute time.
double relativeTimeOffsetHours() const
Returns number of offset hours for relative time formatting.
QString absoluteTimeFormat() const
Returns format used for absolute time.
void setRelativeTimeOffsetHours(double relativeTimeOffsetHours)
Sets number of offset hours for relative time formatting.
bool useAbsoluteTime() const
Returns whether to use absolute time format.
QDateTime absoluteTimeReferenceTime() const
Returns reference time used for absolute time format.
void setAbsoluteTimeReferenceTime(const QDateTime &absoluteTimeReferenceTime)
Sets reference time used for absolute time format.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Writes configuration to a new DOM element.
QString relativeTimeFormat() const
Returns format used for relative time.