forked from qt-creator/qt-creator
MacroExpander: Remove tracking of 'invisible' variables
The 'invisible' flag is only ever used in the VariableChooser, which iterates over visible descriptions. Not registering the descriptions of the unwanted variables serves the same purpose and simplify the code. Change-Id: If5c38bc9b61ca66dae5068983181ec1a85a2c8e6 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -108,7 +108,6 @@ public:
|
||||
|
||||
QHash<QByteArray, MacroExpander::StringFunction> m_map;
|
||||
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
|
||||
QSet<QByteArray> m_invisbleInChooser;
|
||||
QVector<MacroExpander::ResolverFunction> m_extraResolvers;
|
||||
QMap<QByteArray, QString> m_descriptions;
|
||||
QString m_displayName;
|
||||
@@ -336,9 +335,8 @@ void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &desc
|
||||
void MacroExpander::registerVariable(const QByteArray &variable,
|
||||
const QString &description, const StringFunction &value, bool visibleInChooser)
|
||||
{
|
||||
if (!visibleInChooser)
|
||||
d->m_invisbleInChooser.insert(variable);
|
||||
d->m_descriptions.insert(variable, description);
|
||||
if (visibleInChooser)
|
||||
d->m_descriptions.insert(variable, description);
|
||||
d->m_map.insert(variable, value);
|
||||
}
|
||||
|
||||
@@ -419,13 +417,7 @@ void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction
|
||||
*/
|
||||
QList<QByteArray> MacroExpander::visibleVariables() const
|
||||
{
|
||||
QList<QByteArray> res;
|
||||
for (auto it = d->m_descriptions.begin(), end = d->m_descriptions.end(); it != end; ++it) {
|
||||
if (!d->m_invisbleInChooser.contains(it.key()))
|
||||
res.append(it.key());
|
||||
}
|
||||
|
||||
return res;
|
||||
return d->m_descriptions.keys();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user