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.type() == QVariant::Map )
84#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
85 const QVariantMap propsMap = newProps.toMap();
86 for (
auto it = propsMap.constBegin(); it != propsMap.constEnd(); ++it )
87 mMap.insert( it.key(), it.value() );
89 mMap.insert( newProps.toMap() );
95 const QDomNodeList nodes = propsNode.childNodes();
97 for (
int i = 0; i < nodes.size(); i++ )
99 const QDomNode propNode = nodes.at( i );
100 if ( propNode.isNull() || propNode.nodeName() != QLatin1String(
"property" ) )
102 const QDomElement propElement = propNode.toElement();
104 const QString key = propElement.attribute( QStringLiteral(
"key" ) );
105 if ( key.isEmpty() || key.startsWith( keyStartsWith ) )
107 if ( propElement.hasAttribute( QStringLiteral(
"value" ) ) )
109 const QString
value = propElement.attribute( QStringLiteral(
"value" ) );
116 for ( QDomElement itemElement = propElement.firstChildElement( QStringLiteral(
"value" ) );
117 !itemElement.isNull();
118 itemElement = itemElement.nextSiblingElement( QStringLiteral(
"value" ) ) )
120 list << itemElement.text();
123 mMap[key] = QVariant( list );
133 const QDomNodeList propertyList = parentNode.toElement().elementsByTagName( QStringLiteral(
"customproperties" ) );
134 for (
int i = 0; i < propertyList.size(); ++i )
136 parentNode.removeChild( propertyList.at( i ) );
139 QDomElement propsElement = doc.createElement( QStringLiteral(
"customproperties" ) );
141 parentNode.appendChild( propsElement );