forked from qt-creator/qt-creator
JsonWizard: Add a way to check for existence of a variable
Change-Id: Ia1368334156c33ca270b5cc7d946efcdb7b635a8 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -54,6 +54,13 @@ JsonWizard::JsonWizard(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
return v.isValid();
|
return v.isValid();
|
||||||
});
|
});
|
||||||
|
m_expander.registerPrefix("Exists", tr("Check whether a variable exists. Returns \"true\" if it does and an empty string if not."),
|
||||||
|
[this](const QString &value) -> QString
|
||||||
|
{
|
||||||
|
const QString key = QString::fromLatin1("%{") + value + QLatin1Char('}');
|
||||||
|
return m_expander.expand(key) == key ? QString() : QLatin1String("true");
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonWizard::~JsonWizard()
|
JsonWizard::~JsonWizard()
|
||||||
|
|||||||
Reference in New Issue
Block a user