More const ref in foreach loops

parent a7f479f4
......@@ -225,7 +225,7 @@ void GeoGraphicsScene::applyHighlight( const QVector< GeoDataPlacemark* > &selec
void GeoGraphicsScene::removeItem( const GeoDataFeature* feature )
{
QList<TileId> keys = d->m_features.values( feature );
foreach( TileId key, keys ) {
foreach( const TileId& key, keys ) {
QList< GeoGraphicsItem* >& tileList = d->m_items[key];
foreach( GeoGraphicsItem* item, tileList ) {
if( item->feature() == feature ) {
......
......@@ -150,7 +150,7 @@ bool PreviewDialog::deleteTheme( QString directory )
bool result = true;
if (dir.exists(directory)) {
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
Q_FOREACH(const QFileInfo& info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
if (info.isDir()) {
result = deleteTheme(info.absoluteFilePath());
} else {
......
......@@ -938,7 +938,7 @@ bool MarbleZipReader::extractAll(const QString &destinationDir) const
// create directories first
QList<FileInfo> allFiles = fileInfoList();
foreach (FileInfo fi, allFiles) {
foreach (const FileInfo& fi, allFiles) {
const QString absPath = destinationDir + QDir::separator() + fi.filePath;
if (fi.isDir) {
if (!baseDir.mkpath(fi.filePath))
......@@ -949,7 +949,7 @@ bool MarbleZipReader::extractAll(const QString &destinationDir) const
}
// set up symlinks
foreach (FileInfo fi, allFiles) {
foreach (const FileInfo& fi, allFiles) {
const QString absPath = destinationDir + QDir::separator() + fi.filePath;
if (fi.isSymLink) {
QString destination = QFile::decodeName(fileData(fi.filePath));
......@@ -967,7 +967,7 @@ bool MarbleZipReader::extractAll(const QString &destinationDir) const
}
}
foreach (FileInfo fi, allFiles) {
foreach (const FileInfo& fi, allFiles) {
const QString absPath = destinationDir + QDir::separator() + fi.filePath;
if (fi.isFile) {
QDir::root().mkpath(QFileInfo(absPath).dir().absolutePath());
......
......@@ -354,7 +354,7 @@ void BookmarkSyncManager::Private::clearCache()
QStringList() << "*.kml",
QDir::NoFilter, QDir::Name );
if( !fileInfoList.isEmpty() ) {
foreach ( QFileInfo fileInfo, fileInfoList ) {
foreach ( const QFileInfo& fileInfo, fileInfoList ) {
QFile file( fileInfo.absoluteFilePath() );
bool removed = file.remove();
if( !removed ) {
......
......@@ -81,7 +81,7 @@ class ScreenGraphicsItemPrivate : public MarbleGraphicsItemPrivate
QPointF relativePosition = positivePosition();
QList<QPointF> absolutePositions;
foreach( QPointF point, parentPositions ) {
foreach( const QPointF &point, parentPositions ) {
absolutePositions.append( point + relativePosition );
}
......
......@@ -363,7 +363,7 @@ void OsmParser::read( const QFileInfo &content, const QString &areaName )
QSet<QString> keys = QSet<QString>::fromList( waysByName.keys() );
foreach( const QString & key, keys ) {
QList<QList<Way> > merged = merge( waysByName.values( key ) );
foreach( const QList<Way> ways, merged ) {
foreach( const QList<Way> & ways, merged ) {
Q_ASSERT( !ways.isEmpty() );
OsmPlacemark placemark = ways.first();
ways.first().setPosition( m_coordinates, placemark );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment