summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfilesystemmodel_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2013-10-06 22:50:12 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-01-17 13:23:15 +0000
commit89f9f7cbdfd085c3536304ae52b8935096db7217 (patch)
treedfa5c0cdcb8ac253ef0d573b20bd7e539d3bdb7a /src/widgets/dialogs/qfilesystemmodel_p.h
parentd569f37dfd4ca9b2b704e13b95fab96abe0b0f97 (diff)
QFileSystemModel: replace inefficient QList<Fetching> with QVector
The type Fetching is larger than a void*, so holding it in QList is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by holding it in QVector instead. Also optimize the append site by liberal use of std::move(). This code would greatly benefit from emplace_back(), but we can neither assume it's present in std::vector nor do we require the necessary C++11 features that would allow us to implement it in QVector, yet (uniform init and, less so, variadic templates). Change-Id: I50da0ffd557adff57477245d0e8c1fc1fec1ebc1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/dialogs/qfilesystemmodel_p.h')
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index dc4dd26913..8e622e777a 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -324,7 +324,7 @@ public:
QString file;
const QFileSystemNode *node;
};
- QList<Fetching> toFetch;
+ QVector<Fetching> toFetch;
};
Q_DECLARE_TYPEINFO(QFileSystemModelPrivate::Fetching, Q_MOVABLE_TYPE);