JsonWizard: Fix expansion of complex macros

Fix expansion of bool macros and empty string macros embedded into
other macros.

Change-Id: I7d65a4692c48c6299956cc8c4c2c28efb1c8e149
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-06-03 09:55:47 +02:00
parent de5f22a9ba
commit 33a1220019

View File

@@ -128,10 +128,14 @@ QString JsonWizard::stringValue(const QString &n) const
return QString(); return QString();
if (v.type() == QVariant::Bool) if (v.type() == QVariant::Bool)
return v.toBool() ? QString::fromLatin1("true") : QString(); return v.toBool() ? QString::fromLatin1("true") : QString::fromLatin1("false");
if (v.type() == QVariant::String) if (v.type() == QVariant::String) {
return m_expander.expand(v.toString()); QString tmp = m_expander.expand(v.toString());
if (tmp.isEmpty())
tmp = QString::fromLatin1(""); // Make sure isNull() is *not* true.
return tmp;
}
if (v.type() == QVariant::StringList) if (v.type() == QVariant::StringList)
return stringListToArrayString(v.toStringList(), &m_expander); return stringListToArrayString(v.toStringList(), &m_expander);