aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport/exampleslistmodel.cpp
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@digia.com>2014-07-07 19:02:26 +0200
committerDaniel Teske <daniel.teske@digia.com>2014-07-16 18:20:57 +0200
commiteccf1dc1e397303e218eaaf48977fd612cbd3d6a (patch)
tree0681cde5b07e72b5667820c7e4a14d2ff88f4ed1 /src/plugins/qtsupport/exampleslistmodel.cpp
parent71b56d2b9c3264bd481915c763aac685c1ad24d0 (diff)
Even more algorithm usage in ProjectExplorer
Add Utils::transform and anyOf that take a member function pointer. Remove bestElementOr it's unused. Use declval<T> in transform's return type, because msvc does evaluate T() and for types that don't have simple constructor this fails. Add std::remove_reference since decltype returns a reference for lvalues. Change-Id: I22248b226748eeb27af0d300182d574438d7f756 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/qtsupport/exampleslistmodel.cpp')
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp
index 37c2840a42e..5c50e785f57 100644
--- a/src/plugins/qtsupport/exampleslistmodel.cpp
+++ b/src/plugins/qtsupport/exampleslistmodel.cpp
@@ -264,9 +264,7 @@ static QString fixStringForTags(const QString &string)
static QStringList trimStringList(const QStringList &stringlist)
{
- return Utils::transform(stringlist, [](const QString &string) {
- return string.trimmed();
- });
+ return Utils::transform(stringlist, &QString::trimmed);
}
static QString relativeOrInstallPath(const QString &path, const QString &manifestPath,
@@ -782,10 +780,9 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex
const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList();
if (!m_filterTags.isEmpty()) {
- foreach (const QString &tag, m_filterTags)
- if (!tags.contains(tag, Qt::CaseInsensitive))
- return false;
- return true;
+ return Utils::allOf(m_filterTags, [tags](const QString &filterTag) {
+ return tags.contains(filterTag);
+ });
}
if (!m_searchString.isEmpty()) {