summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qitemeditorfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qitemeditorfactory.cpp')
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index e966c83fe7..3287d5dc99 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -47,6 +47,7 @@
#include <qapplication.h>
#include <qdebug.h>
+#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -197,12 +198,12 @@ QItemEditorFactory::~QItemEditorFactory()
*/
void QItemEditorFactory::registerEditor(int userType, QItemEditorCreatorBase *creator)
{
- QHash<int, QItemEditorCreatorBase *>::iterator it = creatorMap.find(userType);
- if (it != creatorMap.end()) {
+ const auto it = creatorMap.constFind(userType);
+ if (it != creatorMap.cend()) {
QItemEditorCreatorBase *oldCreator = it.value();
Q_ASSERT(oldCreator);
creatorMap.erase(it);
- if (!creatorMap.values().contains(oldCreator))
+ if (std::find(creatorMap.cbegin(), creatorMap.cend(), oldCreator) == creatorMap.cend())
delete oldCreator; // if it is no more in use we can delete it
}