From 14a9133abb8b15c8feb9be04d39e31d5a527fad4 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 4 Jun 2018 15:09:38 +0200 Subject: [PATCH] Core: Make preview work when FOO is both a variable and a prefix Make the preview of variable "FOO" work in the variable chooser when the macroexpander also has a prefix "FOO:" defined. The MacroExpander::isPrefixVariable method is broken in this case: It will append ':' to the variable name if it is not there already and will thus return true for both "FOO" and "FOO:". So avoid calling it. In this case this does not even lead to more look-ups: As the variable chooser uses the description of the variable as a key, it contains "FOO:" for the variable name and uses that checks whether "FOO::" is a prefix variable or not. That is always false. Task-number: QTCREATORBUG-20504 Change-Id: I3ea83a4df6d72aac157fa6777106966cc9e9976d Reviewed-by: Eike Ziller --- src/plugins/coreplugin/variablechooser.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index 5f675de7a37..186a74d6a38 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -203,9 +203,7 @@ public: if (role == Qt::ToolTipRole) { QString description = m_expander->variableDescription(m_variable); - QString value; - if (!m_expander->isPrefixVariable(m_variable)) - value = m_expander->value(m_variable).toHtmlEscaped(); + const QString value = m_expander->value(m_variable).toHtmlEscaped(); if (!value.isEmpty()) description += QLatin1String("

") + VariableChooser::tr("Current Value: %1").arg(value); return description;