diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-22 09:12:26 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-22 22:06:06 +0200 |
commit | feecc5a3206e408023ef0d2cb38d3847c3319dee (patch) | |
tree | 6f9c331903f3649fac13a9962642623c96fe05de | |
parent | bbc770080fe51063f8d554d50eb14f53636b940e (diff) |
QQmlPropertyCapture: Replace list with forward list
This required adding one missing function from QFieldList to
QForwardFieldList, but saves one pointer and one quint32.
Change-Id: I022fcd2e6bffe39b2d01f4664fd2ab154445fb00
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/qml/qml/ftw/qfieldlist_p.h | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression_p.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/qml/ftw/qfieldlist_p.h b/src/qml/qml/ftw/qfieldlist_p.h index 66602daab2..b11fbcf40b 100644 --- a/src/qml/qml/ftw/qfieldlist_p.h +++ b/src/qml/qml/ftw/qfieldlist_p.h @@ -66,6 +66,8 @@ public: inline N *takeFirst(); inline void prepend(N *); + template <typename OtherTag> + inline void copyAndClearPrepend(QForwardFieldList<N, nextMember, OtherTag> &); inline bool isEmpty() const; inline bool isOne() const; @@ -151,6 +153,14 @@ void QForwardFieldList<N, nextMember, Tag>::prepend(N *v) } template<class N, N *N::*nextMember, typename Tag> +template <typename OtherTag> +void QForwardFieldList<N, nextMember, Tag>::copyAndClearPrepend(QForwardFieldList<N, nextMember, OtherTag> &o) +{ + _first = nullptr; + while (N *n = o.takeFirst()) prepend(n); +} + +template<class N, N *N::*nextMember, typename Tag> bool QForwardFieldList<N, nextMember, Tag>::isEmpty() const { return _first.isNull(); diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index a1e06e34da..458b056d5e 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -240,7 +240,7 @@ public: QQmlEngine *engine; QQmlJavaScriptExpression *expression; QQmlJavaScriptExpression::DeleteWatcher *watcher; - QFieldList<QQmlJavaScriptExpressionGuard, &QQmlJavaScriptExpressionGuard::next> guards; + QForwardFieldList<QQmlJavaScriptExpressionGuard, &QQmlJavaScriptExpressionGuard::next> guards; QStringList *errorString; bool translationCaptured = false; }; |