diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-12-03 10:46:44 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-12-07 10:16:51 +0000 |
commit | 6d38a1711c7e52c425101d57dd576c7015f39120 (patch) | |
tree | 7f3e8cc6abba097b634fe8a5532842861308365d /src/corelib/itemmodels/qabstractitemmodel.cpp | |
parent | 01a70da3e7432914b59a36c27d2a51b0cf6f876f (diff) |
Use a QMultiHash to store persistent model indices
Because insertMulti() is deprecated.
Change-Id: I47208c281209f19045caa15ea748a2986c2cc0cf
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index af08867dd4..75e13ff994 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -3950,7 +3950,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti /*! \internal - QHash::insertMulti insert the value before the old value. and find() return the new value. + QMultiHash::insert inserts the value before the old value. and find() return the new value. We need insertMultiAtEnd because we don't want to overwrite the old one, which should be removed later There should be only one instance QPersistentModelIndexData per index, but in some intermediate state there may be @@ -3960,9 +3960,9 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti */ void QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(const QModelIndex& key, QPersistentModelIndexData *data) { - QHash<QModelIndex,QPersistentModelIndexData *>::iterator newIt = - indexes.insertMulti(key, data); - QHash<QModelIndex,QPersistentModelIndexData *>::iterator it = newIt + 1; + QHash<QModelIndex,QPersistentModelIndexData *>::iterator newIt = indexes.insert(key, data); + QHash<QModelIndex,QPersistentModelIndexData *>::iterator it = newIt; + ++it; while (it != indexes.end() && it.key() == key) { qSwap(*newIt,*it); newIt = it; |