diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-03 13:06:12 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-19 07:41:50 +0000 |
commit | 66441d7a828ddcdae709cf4699420147f376bdcd (patch) | |
tree | fc16433f11c0eb8dd05971566528c70686a72dcc /src/widgets/itemviews | |
parent | 0f923a8ce45a0b9379bf0a43e68897a3a8333fda (diff) |
Make use of new QHash::erase(const_iterator) overload
Drive-by changes:
- use auto for iterators
- add Q_UNLIKELY for conditions leading to a qWarning etc
Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 5 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index cbf734203a..edfb5c0f57 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4290,9 +4290,8 @@ QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const void QAbstractItemViewPrivate::removeEditor(QWidget *editor) { - QEditorIndexHash::iterator it = editorIndexHash.find(editor); - if (it != editorIndexHash.end()) - { + const auto it = editorIndexHash.constFind(editor); + if (it != editorIndexHash.cend()) { indexEditorHash.remove(it.value()); editorIndexHash.erase(it); } diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 701e7ab79b..3287d5dc99 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -198,8 +198,8 @@ 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); |