22 #include <QDomElement> 24 #include "qgis_core.h" 48 static QgsRectangle readRectangle(
const QDomElement &element );
61 static QDomElement writeRectangle(
const QgsRectangle &rect, QDomDocument &doc );
75 static QDomElement writeVariant(
const QVariant &value, QDomDocument &doc );
80 static QVariant readVariant(
const QDomElement &element );
93 T value = defaultValue;
95 QMetaEnum metaEnum = QMetaEnum::fromType<T>();
96 QString sourceCategoriesStr( element.attribute( attributeName, metaEnum.valueToKeys( static_cast<int>( defaultValue ) ) ) );
97 if ( metaEnum.isValid() )
100 int newValue = metaEnum.keysToValue( sourceCategoriesStr.toUtf8().constData(), &ok );
102 value =
static_cast<T
>( newValue );
109 #endif // QGSXMLUTILS_H A rectangle specified with double values.
Assorted helper methods for reading and writing chunks of XML.
static T readFlagAttribute(const QDomElement &element, const QString &attributeName, T defaultValue)
Read a flag value from an attribute of the element.
DistanceUnit
Units of distance.