diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 1759d6fd0..36be7b90c 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1174,10 +1174,8 @@ QBitArray TorrentHandle::downloadingPieces() const std::vector queue; m_nativeHandle.get_download_queue(queue); - std::vector::const_iterator it = queue.begin(); - std::vector::const_iterator itend = queue.end(); - for (; it != itend; ++it) - result.setBit(it->piece_index); + for (const lt::partial_piece_info &info : queue) + result.setBit(info.piece_index); return result; } diff --git a/src/base/scanfoldersmodel.cpp b/src/base/scanfoldersmodel.cpp index 119b3eea9..8bee1d533 100644 --- a/src/base/scanfoldersmodel.cpp +++ b/src/base/scanfoldersmodel.cpp @@ -341,7 +341,7 @@ void ScanFoldersModel::configure() { const QVariantHash dirs = Preferences::instance()->getScanDirs(); - for (QVariantHash::const_iterator i = dirs.begin(), e = dirs.end(); i != e; ++i) { + for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) { if (i.value().type() == QVariant::Int) addPath(i.key(), static_cast(i.value().toInt()), QString()); else diff --git a/src/gui/torrentcontenttreeview.cpp b/src/gui/torrentcontenttreeview.cpp index 3d9149508..712964a95 100644 --- a/src/gui/torrentcontenttreeview.cpp +++ b/src/gui/torrentcontenttreeview.cpp @@ -69,9 +69,8 @@ void TorrentContentTreeView::keyPressEvent(QKeyEvent *event) const QModelIndexList selection = selectionModel()->selectedRows(TorrentContentModelItem::COL_NAME); - for (QModelIndexList::const_iterator i = selection.begin(); i != selection.end(); ++i) { - QModelIndex index = *i; - Q_ASSERT(i->column() == TorrentContentModelItem::COL_NAME); + for (const QModelIndex &index : selection) { + Q_ASSERT(index.column() == TorrentContentModelItem::COL_NAME); model()->setData(index, state, Qt::CheckStateRole); } } diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index d62942a30..57ca4aa46 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -112,7 +112,7 @@ void AppController::preferencesAction() // Automatically add torrents from const QVariantHash dirs = pref->getScanDirs(); QVariantMap nativeDirs; - for (QVariantHash::const_iterator i = dirs.cbegin(), e = dirs.cend(); i != e; ++i) { + for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) { if (i.value().type() == QVariant::Int) nativeDirs.insert(Utils::Fs::toNativePath(i.key()), i.value().toInt()); else @@ -299,7 +299,7 @@ void AppController::setPreferencesAction() QVariantHash oldScanDirs = pref->getScanDirs(); QVariantHash scanDirs; ScanFoldersModel *model = ScanFoldersModel::instance(); - for (QVariantMap::const_iterator i = nativeDirs.cbegin(), e = nativeDirs.cend(); i != e; ++i) { + for (auto i = nativeDirs.cbegin(); i != nativeDirs.cend(); ++i) { QString folder = Utils::Fs::fromNativePath(i.key()); int downloadType; QString downloadPath;