diff options
author | Marco Bubke <marco.bubke@digia.com> | 2014-04-17 17:41:18 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@digia.com> | 2014-04-17 18:02:28 +0200 |
commit | e9096120ad69202eaf17b392376de798e6a71cd3 (patch) | |
tree | 226b8f88a29f45b7211da977e4e9bc97db29ebeb /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | |
parent | 1c7fc450cc971cc1b62156f689099c0697a3293c (diff) |
QmlDesigner: Fix ignored properties for reparenting
We reparented into ignored properties. Now there is a more general mechanism
to prevent this.
Task-number: QTCREATORBUG-11970
Change-Id: Icbd5877dc13c65963079eb3ab67e48bb92056b53
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 5b745377ed..70fb1ee820 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -558,21 +558,26 @@ bool QuickItemNodeInstance::childItemsHaveContent(QQuickItem *quickItem) return false; } +static bool instanceIsValidLayoutable(const ObjectNodeInstance::Pointer &instance, const PropertyName &propertyName) +{ + return instance && instance->isLayoutable() && !instance->ignoredProperties().contains(propertyName); +} + void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) { - if (oldParentInstance && oldParentInstance->isLayoutable()) { + if (instanceIsValidLayoutable(oldParentInstance, oldParentProperty)) { setInLayoutable(false); setMovable(true); } ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty); - if (newParentInstance && newParentInstance->isLayoutable()) { + if (instanceIsValidLayoutable(newParentInstance, newParentProperty)) { setInLayoutable(true); setMovable(false); } - if (oldParentInstance && oldParentInstance->isLayoutable() && !(newParentInstance && newParentInstance->isLayoutable())) { + if (instanceIsValidLayoutable(oldParentInstance, oldParentProperty) && !instanceIsValidLayoutable(newParentInstance, newParentProperty)) { if (!hasBindingForProperty("x")) setPropertyVariant("x", x()); @@ -583,12 +588,18 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen refresh(); DesignerSupport::updateDirtyNode(quickItem()); - if (parentInstance() && isInLayoutable()) - parentInstance()->refreshLayoutable(); + if (instanceIsValidLayoutable(oldParentInstance, oldParentProperty)) + oldParentInstance->refreshLayoutable(); + + if (instanceIsValidLayoutable(newParentInstance, newParentProperty)) + newParentInstance->refreshLayoutable(); } void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { + if (ignoredProperties().contains(name)) + return; + if (name == "state") return; // states are only set by us @@ -626,6 +637,9 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { + if (ignoredProperties().contains(name)) + return; + if (name == "state") return; // states are only set by us @@ -644,6 +658,9 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q QVariant QuickItemNodeInstance::property(const PropertyName &name) const { + if (ignoredProperties().contains(name)) + return QVariant(); + if (name == "visible") return quickItem()->isVisible(); @@ -652,6 +669,9 @@ QVariant QuickItemNodeInstance::property(const PropertyName &name) const void QuickItemNodeInstance::resetProperty(const PropertyName &name) { + if (ignoredProperties().contains(name)) + return; + if (name == "height") { m_hasHeight = false; m_height = 0.0; |