53 const QDomNode propsNode = parentNode.namedItem( QStringLiteral(
"customproperties" ) );
54 if ( propsNode.isNull() )
57 if ( !keyStartsWith.isEmpty() )
60 QStringList keysToRemove;
61 QMap<QString, QVariant>::const_iterator pIt =
mMap.constBegin();
62 for ( ; pIt !=
mMap.constEnd(); ++pIt )
64 if ( pIt.key().startsWith( keyStartsWith ) )
66 keysToRemove.push_back( pIt.key() );
70 QStringList::const_iterator sIt = keysToRemove.constBegin();
71 for ( ; sIt != keysToRemove.constEnd(); ++sIt )
82 if ( newProps.userType() == QMetaType::Type::QVariantMap )
84 mMap.insert( newProps.toMap() );
89 const QDomNodeList nodes = propsNode.childNodes();
91 for (
int i = 0; i < nodes.size(); i++ )
93 const QDomNode propNode = nodes.at( i );
94 if ( propNode.isNull() || propNode.nodeName() != QLatin1String(
"property" ) )
96 const QDomElement propElement = propNode.toElement();
98 const QString key = propElement.attribute( QStringLiteral(
"key" ) );
99 if ( key.isEmpty() || key.startsWith( keyStartsWith ) )
101 if ( propElement.hasAttribute( QStringLiteral(
"value" ) ) )
103 const QString
value = propElement.attribute( QStringLiteral(
"value" ) );
110 for ( QDomElement itemElement = propElement.firstChildElement( QStringLiteral(
"value" ) );
111 !itemElement.isNull();
112 itemElement = itemElement.nextSiblingElement( QStringLiteral(
"value" ) ) )
114 list << itemElement.text();
117 mMap[key] = QVariant( list );
127 const QDomNodeList propertyList = parentNode.toElement().elementsByTagName( QStringLiteral(
"customproperties" ) );
128 for (
int i = 0; i < propertyList.size(); ++i )
130 parentNode.removeChild( propertyList.at( i ) );
133 QDomElement propsElement = doc.createElement( QStringLiteral(
"customproperties" ) );
135 parentNode.appendChild( propsElement );