33 if (expr.size() != 6) {
35 TagSyntaxError, QStringLiteral(
"widthratio takes five arguments"));
38 if (expr.at(2) != QStringLiteral(
"by")) {
40 QStringLiteral(
"second argument must be 'by'"));
43 if (expr.at(4) != QStringLiteral(
"as")) {
45 QStringLiteral(
"fourth argument must be 'as'"));
49 QStringLiteral(
"\"") + expr.at(3) + QStringLiteral(
"\""), p);
51 auto name = expr.at(5);
53 return new RegroupNode(target, expression, name, p);
67 auto objList = m_target.toList(c);
68 if (objList.isEmpty()) {
69 c->
insert(m_varName, QVariantHash());
91 QVariantList contextList;
93 for (
auto &var : objList) {
95 c->
insert(QStringLiteral(
"var"), var);
100 if (!contextList.isEmpty()) {
101 auto hashVar = contextList.last();
102 hash = hashVar.value<QVariantHash>();
105 const auto it = hash.constFind(QStringLiteral(
"grouper"));
106 if (it == hash.constEnd() || it.value() != key) {
107 contextList.append(QVariantHash{
108 {QStringLiteral(
"grouper"), key},
109 {QStringLiteral(
"list"), QVariantList{ var }},
113 auto itList = hash.find(QStringLiteral(
"list"));
114 if (itList != hash.end()) {
115 list = itList.value().value<QVariantList>();
120 hash.insert(QStringLiteral(
"list"), list);
122 contextList[contextList.size() - 1] = hash;
125 c->
insert(m_varName, contextList);
The Context class holds the context to render a Template with.
void insert(const QString &name, QObject *object)