mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Do not create a backup for Q_FOREACH container
Q_FOREACH will expand and already creates a copy of the contained container, so this is just a waste of cpu cycles and also increases a tiny bit the memory consumption. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									eaacac3217
								
							
						
					
					
						commit
						d993684fec
					
				
					 6 changed files with 7 additions and 12 deletions
				
			
		|  | @ -199,9 +199,8 @@ void DiveListView::unselectDives() | |||
| 
 | ||||
| QList<dive_trip_t *> DiveListView::selectedTrips() | ||||
| { | ||||
| 	QModelIndexList indexes = selectionModel()->selectedRows(); | ||||
| 	QList<dive_trip_t *> ret; | ||||
| 	Q_FOREACH (const QModelIndex &index, indexes) { | ||||
| 	Q_FOREACH (const QModelIndex &index, selectionModel()->selectedRows()) { | ||||
| 		dive_trip_t *trip = static_cast<dive_trip_t *>(index.data(DiveTripModel::TRIP_ROLE).value<void *>()); | ||||
| 		if (!trip) | ||||
| 			continue; | ||||
|  |  | |||
|  | @ -52,8 +52,7 @@ void DivePictureModel::updateDivePictures() | |||
| 		pictures.push_back(QString(picture->filename)); | ||||
| 	} | ||||
| 
 | ||||
| 	SPixmapList retList = QtConcurrent::blockingMapped<SPixmapList>(pictures, scaleImages); | ||||
| 	Q_FOREACH (const SPixmap &pixmap, retList) | ||||
| 	Q_FOREACH (const SPixmap &pixmap, QtConcurrent::blockingMapped<SPixmapList>(pictures, scaleImages)) | ||||
| 		stringPixmapCache[pixmap.first].image = pixmap.second; | ||||
| 
 | ||||
| 	beginInsertRows(QModelIndex(), 0, numberOfPictures - 1); | ||||
|  |  | |||
|  | @ -80,8 +80,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), | |||
| 	ui.timeEdit->installEventFilter(this); | ||||
| 	ui.tagWidget->installEventFilter(this); | ||||
| 
 | ||||
| 	QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children(); | ||||
| 	Q_FOREACH (QObject *obj, statisticsTabWidgets) { | ||||
| 	Q_FOREACH (QObject *obj, ui.statisticsTab->children()) { | ||||
| 		QLabel *label = qobject_cast<QLabel *>(obj); | ||||
| 		if (label) | ||||
| 			label->setAlignment(Qt::AlignHCenter); | ||||
|  |  | |||
|  | @ -2035,8 +2035,7 @@ LanguageModel::LanguageModel(QObject *parent) : QAbstractListModel(parent) | |||
| { | ||||
| 	QSettings s; | ||||
| 	QDir d(getSubsurfaceDataPath("translations")); | ||||
| 	QStringList result = d.entryList(); | ||||
| 	Q_FOREACH (const QString &s, result) { | ||||
| 	Q_FOREACH (const QString &s, d.entryList()) { | ||||
| 		if (s.startsWith("subsurface_") && s.endsWith(".qm")) { | ||||
| 			languages.push_back((s == "subsurface_source.qm") ? "English" : s); | ||||
| 		} | ||||
|  |  | |||
|  | @ -399,8 +399,7 @@ void PreferencesDialog::on_resetSettings_clicked() | |||
| 	if (result == QMessageBox::Ok) { | ||||
| 		prefs = default_prefs; | ||||
| 		setUiFromPrefs(); | ||||
| 		QStringList keys = s.allKeys(); | ||||
| 		Q_FOREACH (QString key, keys) { | ||||
| 		Q_FOREACH (QString key, s.allKeys()) { | ||||
| 			s.remove(key); | ||||
| 		} | ||||
| 		syncSettings(); | ||||
|  |  | |||
|  | @ -229,8 +229,8 @@ void ToolTipItem::refresh(const QPointF &pos) | |||
| 	addToolTip(QString::fromUtf8(mb.buffer, mb.len)); | ||||
| 	free_buffer(&mb); | ||||
| 
 | ||||
| 	QList<QGraphicsItem *> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, scene()->views().first()->transform()); | ||||
| 	Q_FOREACH (QGraphicsItem *item, items) { | ||||
| 	Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemShape | ||||
| 		,Qt::DescendingOrder, scene()->views().first()->transform())) { | ||||
| 		if (!item->toolTip().isEmpty()) | ||||
| 			addToolTip(item->toolTip()); | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue