forked from qt-creator/qt-creator
Restore JsonWizard expander functionality
Task-number: QTCREATORBUG-13229 Change-Id: I91fd996cdbf5f3e71bdf817e9c5beebbb007681b Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -63,6 +63,13 @@ public:
|
||||
return expander && expander->resolveMacro(name, ret);
|
||||
});
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
found = Utils::anyOf(m_extraResolvers, [name, ret] (const MacroExpander::ResolverFunction &resolver) {
|
||||
return resolver(name, ret);
|
||||
});
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
@@ -94,6 +101,7 @@ public:
|
||||
|
||||
QHash<QByteArray, MacroExpander::StringFunction> m_map;
|
||||
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
|
||||
QVector<MacroExpander::ResolverFunction> m_extraResolvers;
|
||||
QMap<QByteArray, QString> m_descriptions;
|
||||
QString m_displayName;
|
||||
QVector<MacroExpanderProvider> m_subProviders;
|
||||
@@ -343,6 +351,11 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
|
||||
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).baseName(); });
|
||||
}
|
||||
|
||||
void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction &value)
|
||||
{
|
||||
d->m_extraResolvers.append(value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns all registered variable names.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user