MacroExpander: Add a way to generate a new UUID

Change-Id: I5c43419f717d84bd9954a4921eb6e6723d331646
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-11-30 14:55:40 +01:00
parent 62e9d51c46
commit 09102ddc7b

View File

@@ -61,6 +61,7 @@
#include <QDebug> #include <QDebug>
#include <QDateTime> #include <QDateTime>
#include <QMenu> #include <QMenu>
#include <QUuid>
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
@@ -204,6 +205,8 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
[](const QString &fmt) { return QDate::currentDate().toString(fmt); }); [](const QString &fmt) { return QDate::currentDate().toString(fmt); });
expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."), expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."),
[](const QString &fmt) { return QTime::currentTime().toString(fmt); }); [](const QString &fmt) { return QTime::currentTime().toString(fmt); });
expander->registerVariable("UUID", tr("Generate a new UUID."),
[]() { return QUuid::createUuid().toString(); });
expander->registerPrefix("#:", tr("A comment."), [](const QString &) { return QStringLiteral(""); }); expander->registerPrefix("#:", tr("A comment."), [](const QString &) { return QStringLiteral(""); });