QStandardItemModel: port a local QSet to QDuplicateTracker
Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: I59242287debfd1e41c663aa2b88d0d3ea44f43fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
a1947aeffe
commit
0bed456f47
@ -48,7 +48,7 @@
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qbitarray.h>
|
||||
#include <QtCore/qmimedata.h>
|
||||
|
||||
#include <private/qduplicatetracker_p.h>
|
||||
#include <private/qstandarditemmodel_p.h>
|
||||
#include <qdebug.h>
|
||||
#include <algorithm>
|
||||
@ -3114,12 +3114,11 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
||||
|
||||
//remove duplicates childrens
|
||||
{
|
||||
QSet<QStandardItem *> seen;
|
||||
QDuplicateTracker<QStandardItem *> seen;
|
||||
while (!stack.isEmpty()) {
|
||||
QStandardItem *itm = stack.pop();
|
||||
if (seen.contains(itm))
|
||||
if (seen.hasSeen(itm))
|
||||
continue;
|
||||
seen.insert(itm);
|
||||
|
||||
const QVector<QStandardItem*> &childList = itm->d_func()->children;
|
||||
for (int i = 0; i < childList.count(); ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user