From d8c865e4380a922790f6f193cb621b52299d4e8b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Jul 2020 11:53:29 -0400 Subject: [PATCH] CResourceMimeData: Make use of std::move --- .../ResourceBrowser/CResourceMimeData.h | 21 +++++++++---------- .../ResourceBrowser/CResourceTableModel.cpp | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Editor/ResourceBrowser/CResourceMimeData.h b/src/Editor/ResourceBrowser/CResourceMimeData.h index d2bfbb92..0ce0428e 100644 --- a/src/Editor/ResourceBrowser/CResourceMimeData.h +++ b/src/Editor/ResourceBrowser/CResourceMimeData.h @@ -12,22 +12,21 @@ class CResourceMimeData : public QMimeData QList mDirectories; public: - CResourceMimeData(const QList& rkEntries, const QList& rkDirectories) - : QMimeData() - , mEntries(rkEntries) - , mDirectories(rkDirectories) - {} - - CResourceMimeData(CResourceEntry *pEntry) + CResourceMimeData(QList entries, QList directories) : QMimeData() + , mEntries(std::move(entries)) + , mDirectories(std::move(directories)) { - mEntries << pEntry; } - CResourceMimeData(CVirtualDirectory *pDir) - : QMimeData() + explicit CResourceMimeData(CResourceEntry *pEntry) + : QMimeData(), mEntries{pEntry} + { + } + + explicit CResourceMimeData(CVirtualDirectory *pDir) + : QMimeData(), mDirectories{pDir} { - mDirectories << pDir; } const QList& Resources() const { return mEntries; } diff --git a/src/Editor/ResourceBrowser/CResourceTableModel.cpp b/src/Editor/ResourceBrowser/CResourceTableModel.cpp index 650d95b0..3f33139f 100644 --- a/src/Editor/ResourceBrowser/CResourceTableModel.cpp +++ b/src/Editor/ResourceBrowser/CResourceTableModel.cpp @@ -143,7 +143,7 @@ QMimeData* CResourceTableModel::mimeData(const QModelIndexList& rkIndexes) const Dirs.push_back(pDir); } - return new CResourceMimeData(Resources, Dirs); + return new CResourceMimeData(std::move(Resources), std::move(Dirs)); } Qt::DropActions CResourceTableModel::supportedDragActions() const