Core: Add the "resourcePath" to the global macro expander

Example use case: Multiple wizard json files want to reference a shared
resource file without using fragile relative paths.

Change-Id: I2502083d4c371c25a8b66e7d5d3b4fb9d8697317
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Alessandro Portale
2017-05-22 16:29:47 +02:00
parent df38b384d4
commit dff0c9df7a

View File

@@ -193,6 +193,8 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
[]() { return QVariant(Utils::HostOsInfo::isLinuxHost()).toString(); });
expander->registerVariable("HostOs:isUnix", tr("Is Qt Creator running on any unix-based platform?"),
[]() { return QVariant(Utils::HostOsInfo::isAnyUnixHost()).toString(); });
expander->registerVariable("IDE:ResourcePath", tr("The directory where Qt Creator finds its pre-installed resources."),
[]() { return ICore::resourcePath(); });
expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."),
[](const QString &fmt) { return QDate::currentDate().toString(fmt); });
expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."),