summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/qlistview-dnd/model.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-26 12:03:00 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-26 14:04:18 (GMT)
commita882a46b1c60e5774ade68eaac60922b19a08835 (patch)
treed603f2ad38e235392e3bccdee51836c2667cfda7 /doc/src/snippets/qlistview-dnd/model.cpp
parent3a08c5b1682e211bf664c21850187e2b15e89c23 (diff)
downloadQt-a882a46b1c60e5774ade68eaac60922b19a08835.zip
Qt-a882a46b1c60e5774ade68eaac60922b19a08835.tar.gz
Qt-a882a46b1c60e5774ade68eaac60922b19a08835.tar.bz2
Doc: use const& in foreach when applicable.
Const reference are slightly faster than doing a copy of the object on each iteration. Lead by example by having this pattern right in our documentation
Diffstat (limited to 'doc/src/snippets/qlistview-dnd/model.cpp')
-rw-r--r--doc/src/snippets/qlistview-dnd/model.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/src/snippets/qlistview-dnd/model.cpp b/doc/src/snippets/qlistview-dnd/model.cpp
index d310c03..bca71ee 100644
--- a/doc/src/snippets/qlistview-dnd/model.cpp
+++ b/doc/src/snippets/qlistview-dnd/model.cpp
@@ -109,7 +109,7 @@ bool DragDropListModel::dropMimeData(const QMimeData *data,
//! [6]
insertRows(beginRow, rows, QModelIndex());
- foreach (QString text, newItems) {
+ foreach (const QString &text, newItems) {
QModelIndex idx = index(beginRow, 0, QModelIndex());
setData(idx, text);
beginRow++;
@@ -139,7 +139,7 @@ QMimeData *DragDropListModel::mimeData(const QModelIndexList &indexes) const
QDataStream stream(&encodedData, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
+ foreach (const QModelIndex &index, indexes) {
if (index.isValid()) {
QString text = data(index, Qt::DisplayRole).toString();
stream << text;