Commit 8aa7bb2a authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

projectfilter: port foreach -> range-based for

parent 9756bab6
......@@ -52,7 +52,7 @@ void ComboBoxDelegate::setEditorData(QWidget* editor, const QModelIndex& index)
const QString& current = index.data().toString();
int currentIndex = -1;
int i = 0;
foreach(const Item& item, m_items) {
for (const Item& item : m_items) {
if (item.text == current) {
currentIndex = i;
}
......
......@@ -67,7 +67,7 @@ bool ProjectFilter::isValid( const Path &path, const bool isFolder ) const
}
bool isValid = true;
foreach( const Filter& filter, m_filters ) {
for (const Filter& filter : m_filters) {
if (isFolder && !(filter.targets & Filter::Folders)) {
continue;
} else if (!isFolder && !(filter.targets & Filter::Files)) {
......
......@@ -170,7 +170,8 @@ void ProjectFilterConfigPage::checkFilters()
{
// check for errors, only show one error at once
QString errorText;
foreach(const Filter& filter, m_model->filters()) {
const auto filters = m_model->filters();
for (const Filter& filter : filters) {
const QString &pattern = filter.pattern.pattern();
if (pattern.isEmpty()) {
errorText = i18n("A filter with an empty pattern will match all items. Use <code>\"*\"</code> to make this explicit.");
......
......@@ -53,7 +53,8 @@ ProjectFilterProvider::ProjectFilterProvider( QObject* parent, const QVariantLis
this, &ProjectFilterProvider::projectAboutToBeOpened);
// initialize the filters for each project
foreach(IProject* project, core()->projectController()->projects()) {
const auto projects = core()->projectController()->projects();
for (IProject* project : projects) {
updateProjectFilters(project);
}
}
......
......@@ -359,10 +359,10 @@ static QVector<BenchData> createBenchData(const Path& base, int folderDepth, int
void TestProjectFilter::bench()
{
QFETCH(TestFilter, filter);
QFETCH(QVector<BenchData>, data);
QFETCH(const QVector<BenchData>, data);
QBENCHMARK {
foreach(const BenchData& bench, data) {
for (const BenchData& bench : data) {
filter->isValid(bench.path, bench.isFolder);
}
}
......
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