diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-11 13:59:46 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-13 14:03:41 +0200 |
commit | f2a15482ddd289a36b04316a2b6ebed83eb017c5 (patch) | |
tree | b2588d056ae5a80ac4b726571f6e1e3b0e362f8c /src/qml/jsruntime | |
parent | 4e645c7c33b03adf2d9161b00d00267add0aa373 (diff) |
Add a Pragma for list assign behavior
[ChangeLog][QtQml] You can now specify the list property assignment
behavior in QML using the "ListPropertyAssignBehavior" pragma. This is
analogous to the macros you can use in C++.
Fixes: QTBUG-93642
Change-Id: I9bdcf198031f1e24891f947b0990a3253d29a998
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit_p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h index 9ceec1fbf7..e4670553cb 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit_p.h +++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h @@ -190,6 +190,15 @@ public: // --- interface for QQmlPropertyCacheCreator using CompiledObject = CompiledData::Object; using CompiledFunction = CompiledData::Function; + enum class ListPropertyAssignBehavior { Append, Replace, ReplaceIfNotDefault }; + ListPropertyAssignBehavior listPropertyAssignBehavior() const + { + if (data->flags & CompiledData::Unit::ListPropertyAssignReplace) + return ListPropertyAssignBehavior::Replace; + if (data->flags & CompiledData::Unit::ListPropertyAssignReplaceIfNotDefault) + return ListPropertyAssignBehavior::ReplaceIfNotDefault; + return ListPropertyAssignBehavior::Append; + } int objectCount() const { return qmlData->nObjects; } const CompiledObject *objectAt(int index) const |