22 #include <QDomElement>
25 #include "qgis_core.h"
49 static QgsRectangle readRectangle(
const QDomElement &element );
62 static QDomElement writeRectangle(
const QgsRectangle &rect, QDomDocument &doc );
76 static QDomElement writeVariant(
const QVariant &value, QDomDocument &doc );
81 static QVariant readVariant(
const QDomElement &element );
94 T value = defaultValue;
96 QMetaEnum metaEnum = QMetaEnum::fromType<T>();
97 QString sourceCategoriesStr( element.attribute( attributeName, metaEnum.valueToKeys(
static_cast<int>( defaultValue ) ) ) );
98 if ( metaEnum.isValid() )
101 int newValue = metaEnum.keysToValue( sourceCategoriesStr.toUtf8().constData(), &ok );
103 value =
static_cast<T
>( newValue );
110 #endif // QGSXMLUTILS_H