Commit b3e47623 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Merged "Methods" and QML "Functions" locator filters

They're still separate filters, but by default they share the same
prefix, which will now make sure that only one entry shows up in the
list of filters.

Done-with: Christian Kamm
Task-number: QTCREATORBUG-4796
parent 6b5ce26b
......@@ -46,7 +46,7 @@ public:
CppFunctionsFilter(CppModelManager *manager);
~CppFunctionsFilter();
QString displayName() const { return tr("Methods"); }
QString displayName() const { return tr("Methods and functions"); }
QString id() const { return QLatin1String("Methods"); }
Priority priority() const { return Medium; }
};
......
......@@ -69,20 +69,28 @@ ILocatorFilter::Priority LocatorFiltersFilter::priority() const
QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
{
QList<FilterEntry> entries;
if (entry.isEmpty()) {
foreach (ILocatorFilter *filter, m_plugin->filters()) {
if (future.isCanceled())
break;
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
FilterEntry filterEntry(this,
filter->shortcutString(),
QVariant::fromValue(filter),
m_icon);
filterEntry.extraInfo = filter->displayName();
entries.append(filterEntry);
}
if (!entry.isEmpty())
return entries;
QMap<QString, ILocatorFilter*> uniqueFilters;
foreach (ILocatorFilter *filter, m_plugin->filters()) {
const QString filterId = filter->shortcutString() + QLatin1Char(',') + filter->displayName();
uniqueFilters.insert(filterId, filter);
}
foreach (ILocatorFilter *filter, uniqueFilters) {
if (future.isCanceled())
break;
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
FilterEntry filterEntry(this,
filter->shortcutString(),
QVariant::fromValue(filter),
m_icon);
filterEntry.extraInfo = filter->displayName();
entries.append(filterEntry);
}
}
return entries;
}
......
......@@ -47,7 +47,7 @@ public:
explicit FunctionFilter(LocatorData *data, QObject *parent = 0);
~FunctionFilter();
QString displayName() const { return tr("Functions"); }
QString displayName() const { return tr("Methods and functions"); }
QString id() const { return QLatin1String("Functions"); }
Priority priority() const { return Medium; }
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
......
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