aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel_p_p.h
diff options
context:
space:
mode:
authorMichael Brasser <mbrasser@ford.com>2017-09-21 16:29:39 -0500
committerMichael Brasser <michael.brasser@live.com>2017-10-24 14:35:53 +0000
commitecf6a2a3658fa17cd4c34f1dd5acc1904f8b4314 (patch)
treeca0d487899e9a38132260b0a27ee44f5421025c2 /src/qml/types/qqmllistmodel_p_p.h
parentf23ee3368ea62930587358d2dff9ec2cb70668f1 (diff)
Allow assigning functions in ListElement
As an alternative to using eval with a string. This allows code such as: // model ListElement { action: function() { doSomething() } } // delegate MouseArea { onClicked: model.action() } [ChangeLog][ListModel] Support assignment of function declarations in ListElement, to allow for models with actions. Change-Id: I50d188ab30f43b2b8a47f48ceb4281d3ca55bd44 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types/qqmllistmodel_p_p.h')
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 77d2002afa..612b80b9d7 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -216,6 +216,7 @@ public:
QObject,
VariantMap,
DateTime,
+ Function,
MaxDataType
};
@@ -283,6 +284,7 @@ private:
int setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o);
int setVariantMapProperty(const ListLayout::Role &role, QVariantMap *m);
int setDateTimeProperty(const ListLayout::Role &role, const QDateTime &dt);
+ int setFunctionProperty(const ListLayout::Role &role, const QJSValue &f);
void setStringPropertyFast(const ListLayout::Role &role, const QString &s);
void setDoublePropertyFast(const ListLayout::Role &role, double n);
@@ -291,6 +293,7 @@ private:
void setListPropertyFast(const ListLayout::Role &role, ListModel *m);
void setVariantMapFast(const ListLayout::Role &role, QV4::Object *o);
void setDateTimePropertyFast(const ListLayout::Role &role, const QDateTime &dt);
+ void setFunctionPropertyFast(const ListLayout::Role &role, const QJSValue &f);
void clearProperty(const ListLayout::Role &role);
@@ -301,6 +304,7 @@ private:
QPointer<QObject> *getGuardProperty(const ListLayout::Role &role);
QVariantMap *getVariantMapProperty(const ListLayout::Role &role);
QDateTime *getDateTimeProperty(const ListLayout::Role &role);
+ QJSValue *getFunctionProperty(const ListLayout::Role &role);
inline char *getPropertyMemory(const ListLayout::Role &role);
@@ -401,6 +405,7 @@ private:
friend class ListElement;
friend class QQmlListModelWorkerAgent;
+ friend class QQmlListModelParser;
};
QT_END_NAMESPACE