Aspects: Fix duplicate global variables

The global variables got added twice for StringAspects.

Fixes: QTCREATORBUG-31183
Change-Id: I3feaf56cbc78bae0bb2da8f5ba5327a2ca038810
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2024-07-03 13:08:25 +02:00
parent 49587951aa
commit cb299e38e9

View File

@@ -742,6 +742,8 @@ void BaseAspect::addMacroExpansion(QWidget *w)
return;
const auto chooser = new VariableChooser(w);
chooser->addSupportedWidget(w);
if (d->m_expander == globalMacroExpander()) // default for VariableChooser()
return;
chooser->addMacroExpanderProvider([this] { return d->m_expander; });
if (auto pathChooser = qobject_cast<PathChooser *>(w))
pathChooser->setMacroExpander(d->m_expander);