summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/variablechooser.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2018-06-04 15:09:38 +0200
committerTobias Hunger <tobias.hunger@qt.io>2018-06-05 08:09:35 +0000
commit14a9133abb8b15c8feb9be04d39e31d5a527fad4 (patch)
tree6b26262e1272537cc37164987d19aaa9a8d659c9 /src/plugins/coreplugin/variablechooser.cpp
parent2fb270c77f6c7bef6b9f56d49ee8353cca78fdb1 (diff)
downloadqt-creator-14a9133abb8b15c8feb9be04d39e31d5a527fad4.tar.gz
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:<value>" for the variable name and uses that checks whether "FOO:<value>:" is a prefix variable or not. That is always false. Task-number: QTCREATORBUG-20504 Change-Id: I3ea83a4df6d72aac157fa6777106966cc9e9976d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/variablechooser.cpp')
-rw-r--r--src/plugins/coreplugin/variablechooser.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp
index 5f675de7a3..186a74d6a3 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("<p>") + VariableChooser::tr("Current Value: %1").arg(value);
return description;