QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsmeshtimesettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshtimesettings.cpp
3 -- ---------------------
4  begin : March 2019
5  copyright : (C) 2019 by Peter Petrik
6  email : zilolv at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsmeshtimesettings.h"
19 
21 
22 
23 QDomElement QgsMeshTimeSettings::writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const
24 {
25  Q_UNUSED( context )
26  QDomElement elem = doc.createElement( QStringLiteral( "mesh-time-settings" ) );
27  elem.setAttribute( QStringLiteral( "relative-time-format" ), mRelativeTimeFormat );
28  elem.setAttribute( QStringLiteral( "absolute-time-format" ), mAbsoluteTimeFormat );
29  return elem;
30 }
31 
32 void QgsMeshTimeSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
33 {
34  Q_UNUSED( context )
35  mRelativeTimeFormat = elem.attribute( QStringLiteral( "relative-time-format" ) );
36  mAbsoluteTimeFormat = elem.attribute( QStringLiteral( "absolute-time-format" ) );
37 }
38 
40 {
41  return mRelativeTimeFormat;
42 }
43 
44 void QgsMeshTimeSettings::setRelativeTimeFormat( const QString &relativeTimeFormat )
45 {
46  mRelativeTimeFormat = relativeTimeFormat;
47 }
48 
50 {
51  return mAbsoluteTimeFormat;
52 }
53 
54 void QgsMeshTimeSettings::setAbsoluteTimeFormat( const QString &absoluteTimeFormat )
55 {
56  mAbsoluteTimeFormat = absoluteTimeFormat;
57 }
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsMeshTimeSettings::writeXml
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Writes configuration to a new DOM element.
Definition: qgsmeshtimesettings.cpp:23
qgsmeshtimesettings.h
QgsMeshTimeSettings::relativeTimeFormat
QString relativeTimeFormat() const
Returns format used for relative time.
Definition: qgsmeshtimesettings.cpp:39
QgsMeshTimeSettings::readXml
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads configuration from the given DOM element.
Definition: qgsmeshtimesettings.cpp:32
QgsMeshTimeSettings::absoluteTimeFormat
QString absoluteTimeFormat() const
Returns format used for absolute time.
Definition: qgsmeshtimesettings.cpp:49
QgsMeshTimeSettings::QgsMeshTimeSettings
QgsMeshTimeSettings()
QgsMeshTimeSettings::setAbsoluteTimeFormat
void setAbsoluteTimeFormat(const QString &absoluteTimeFormat)
Sets format used for absolute time.
Definition: qgsmeshtimesettings.cpp:54
QgsMeshTimeSettings::setRelativeTimeFormat
void setRelativeTimeFormat(const QString &relativeTimeFormat)
Sets format used for relative time.
Definition: qgsmeshtimesettings.cpp:44