diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-22 10:48:23 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-10-12 17:50:07 +0200 |
commit | a243f1eeeb9eda237ea2f6dad403984ab14aa375 (patch) | |
tree | 3ded380bfe0f1293263403d2676a3e3db0709160 /src/qml/qml/qqmlpropertycachecreator_p.h | |
parent | 7750609d8850f6b36317b6243db77b3fe98fd841 (diff) |
Fix QProperty property interaction with aliases
With this change, an alias of a bindable property is also bindable, and
shares its bindable interface with the target.
Moreover, the logic in QQmlTypeCompiler is adjusted so that a change
handler of an alias uses the bindable interface if possible, instead of
connecting to the alias' change signal. That would never be emitted if
the target is a QProperty without a notify signal.
Alias properties still have a change signal, but those never get
emitted.
Change-Id: I857dfdbe51048a2b604ad632982e7f4adac6b907
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycachecreator_p.h')
-rw-r--r-- | src/qml/qml/qqmlpropertycachecreator_p.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index 626b274c2f..21551db5c4 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -785,6 +785,7 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor *type = 0; bool writable = false; bool resettable = false; + bool bindable = false; propertyFlags->setIsAlias(true); @@ -861,13 +862,14 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor *type = targetProperty->propType(); writable = targetProperty->isWritable(); resettable = targetProperty->isResettable(); - + bindable = targetProperty->isBindable(); } else { // value type or primitive type or enum *type = targetProperty->propType(); writable = targetProperty->isWritable(); resettable = targetProperty->isResettable(); + bindable = targetProperty->isBindable(); if (valueTypeIndex != -1) { const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(*type); @@ -891,6 +893,7 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor propertyFlags->setIsWritable(!(alias.flags & QV4::CompiledData::Alias::IsReadOnly) && writable); propertyFlags->setIsResettable(resettable); + propertyFlags->setIsBindable(bindable); return QQmlError(); } |