Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Use QMultiMap instead of QMap

Michael Genda0221f98213c1
diff --git a/libs/flake/KoResourceManager_p.cpp b/libs/flake/KoResourceManager_p.cpp
index 8a2b67fe4f..b95f144056 100644
--- a/libs/flake/KoResourceManager_p.cpp
+++ b/libs/flake/KoResourceManager_p.cpp
@@ -236,7 +236,7 @@ void KoResourceManager::addDerivedResourceConverter(KoDerivedResourceConverterSP
KIS_SAFE_ASSERT_RECOVER_NOOP(!m_derivedResources.contains(converter->key()));
m_derivedResources.insert(converter->key(), converter);
- m_derivedFromSource.insertMulti(converter->sourceKey(), converter);
+ m_derivedFromSource.insert(converter->sourceKey(), converter);
}
bool KoResourceManager::hasDerivedResourceConverter(int key)
@@ -275,8 +275,8 @@ void KoResourceManager::addActiveCanvasResourceDependency(KoActiveCanvasResource
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!hasActiveCanvasResourceDependency(dep->sourceKey(), dep->targetKey()));
- m_dependencyFromSource.insertMulti(dep->sourceKey(), dep);
- m_dependencyFromTarget.insertMulti(dep->targetKey(), dep);
+ m_dependencyFromSource.insert(dep->sourceKey(), dep);
+ m_dependencyFromTarget.insert(dep->targetKey(), dep);
}
bool KoResourceManager::hasActiveCanvasResourceDependency(int sourceKey, int targetKey) const
diff --git a/libs/flake/KoShapeLoadingContext.cpp b/libs/flake/KoShapeLoadingContext.cpp
index e5712f06ac..d546586e6b 100644
--- a/libs/flake/KoShapeLoadingContext.cpp
+++ b/libs/flake/KoShapeLoadingContext.cpp
@@ -6,6 +6,8 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
+#include <QMultiMap>
+
#include "KoShapeLoadingContext.h"
#include "KoShape.h"
#include "KoShapeContainer.h"
@@ -48,8 +50,8 @@ public:
QMap<QString, QPair<KoShape *, QVariant> > subIds;
QMap<QString, KoSharedLoadingData *> sharedData; //FIXME: use QScopedPointer here to auto delete in destructor
int zIndex;
- QMap<QString, KoLoadingShapeUpdater*> updaterById;
- QMap<KoShape *, KoLoadingShapeUpdater*> updaterByShape;
+ QMultiMap<QString, KoLoadingShapeUpdater*> updaterById;
+ QMultiMap<KoShape *, KoLoadingShapeUpdater*> updaterByShape;
KoDocumentResourceManager *documentResources;
KoSectionModel *sectionModel; };
@@ -95,7 +97,7 @@ void KoShapeLoadingContext::addShapeId(KoShape * shape, const QString & id)
d->drawIds.insert(id, shape);
QMap<QString, KoLoadingShapeUpdater*>::iterator it(d->updaterById.find(id));
while (it != d->updaterById.end() && it.key() == id) {
- d->updaterByShape.insertMulti(shape, it.value());
+ d->updaterByShape.insert(shape, it.value());
it = d->updaterById.erase(it);
}
}
@@ -119,7 +121,7 @@ QPair<KoShape *, QVariant> KoShapeLoadingContext::shapeSubItemById(const QString
// TODO make sure to remove the shape from the loading context when loading for it failed and it was deleted. This can also happen when the parent is deleted
void KoShapeLoadingContext::updateShape(const QString & id, KoLoadingShapeUpdater * shapeUpdater)
{
- d->updaterById.insertMulti(id, shapeUpdater);
+ d->updaterById.insert(id, shapeUpdater);
}
void KoShapeLoadingContext::shapeLoaded(KoShape * shape)
diff --git a/libs/resources/KoResourceBundleManifest.cpp b/libs/resources/KoResourceBundleManifest.cpp
index 7985a18c8c..867a0fafa7 100644
--- a/libs/resources/KoResourceBundleManifest.cpp
+++ b/libs/resources/KoResourceBundleManifest.cpp
@@ -133,7 +133,7 @@ bool KoResourceBundleManifest::save(QIODevice *device)
manifestWriter.addAttribute("manifest:version", "1.2");
manifestWriter.addManifestEntry("/", "application/x-krita-resourcebundle");
- Q_FOREACH (QString resourceType, m_resources.uniqueKeys()) {
+ Q_FOREACH (QString resourceType, m_resources.keys()) {
Q_FOREACH (const ResourceReference &resource, m_resources[resourceType].values()) {
manifestWriter.startElement("manifest:file-entry");
manifestWriter.addAttribute("manifest:media-type", resourceTypeToManifestType(resourceType));