QtDialog: add reference in foreach

This commit is contained in:
Daniel Pfeifer
2017-05-04 22:23:46 +02:00
parent 377d4df279
commit 726b3b6f75
3 changed files with 9 additions and 9 deletions

View File

@@ -990,10 +990,10 @@ void CMakeSetupDialog::removeSelectedCacheEntries()
{ {
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows(); QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
QList<QPersistentModelIndex> pidxs; QList<QPersistentModelIndex> pidxs;
foreach (QModelIndex i, idxs) { foreach (QModelIndex const& i, idxs) {
pidxs.append(i); pidxs.append(i);
} }
foreach (QPersistentModelIndex pi, pidxs) { foreach (QPersistentModelIndex const& pi, pidxs) {
this->CacheValues->model()->removeRow(pi.row(), pi.parent()); this->CacheValues->model()->removeRow(pi.row(), pi.parent());
} }
} }
@@ -1152,7 +1152,7 @@ void CMakeSetupDialog::showUserChanges()
QString command; QString command;
QString cache; QString cache;
foreach (QCMakeProperty prop, changes) { foreach (QCMakeProperty const& prop, changes) {
QString type; QString type;
switch (prop.Type) { switch (prop.Type) {
case QCMakeProperty::BOOL: case QCMakeProperty::BOOL:

View File

@@ -219,14 +219,14 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
} }
// remove some properites // remove some properites
foreach (QString s, toremove) { foreach (QString const& s, toremove) {
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data()); this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
state->RemoveCacheEntry(s.toLocal8Bit().data()); state->RemoveCacheEntry(s.toLocal8Bit().data());
} }
// add some new properites // add some new properites
foreach (QCMakeProperty s, props) { foreach (QCMakeProperty const& s, props) {
this->CMakeInstance->WatchUnusedCli(s.Key.toLocal8Bit().data()); this->CMakeInstance->WatchUnusedCli(s.Key.toLocal8Bit().data());
if (s.Type == QCMakeProperty::BOOL) { if (s.Type == QCMakeProperty::BOOL) {

View File

@@ -47,7 +47,7 @@ protected:
} }
// check all strings for a match // check all strings for a match
foreach (QString str, strs) { foreach (QString const& str, strs) {
if (str.contains(this->filterRegExp())) { if (str.contains(this->filterRegExp())) {
return true; return true;
} }
@@ -236,12 +236,12 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
qSort(newP); qSort(newP);
qSort(newP2); qSort(newP2);
int row_count = 0; int row_count = 0;
foreach (QCMakeProperty p, newP) { foreach (QCMakeProperty const& p, newP) {
this->insertRow(row_count); this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, true); this->setPropertyData(this->index(row_count, 0), p, true);
row_count++; row_count++;
} }
foreach (QCMakeProperty p, newP2) { foreach (QCMakeProperty const& p, newP2) {
this->insertRow(row_count); this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, false); this->setPropertyData(this->index(row_count, 0), p, false);
row_count++; row_count++;
@@ -399,7 +399,7 @@ void QCMakeCacheModel::breakProperties(
{ {
QMap<QString, QCMakePropertyList> tmp; QMap<QString, QCMakePropertyList> tmp;
// return a map of properties grouped by prefixes, and sorted // return a map of properties grouped by prefixes, and sorted
foreach (QCMakeProperty p, props) { foreach (QCMakeProperty const& p, props) {
QString prefix = QCMakeCacheModel::prefix(p.Key); QString prefix = QCMakeCacheModel::prefix(p.Key);
tmp[prefix].append(p); tmp[prefix].append(p);
} }