diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-10-21 09:13:03 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-10-21 09:13:03 +0200 |
commit | bb9774de92dd2c8da85c5231ca5646b078cb42a3 (patch) | |
tree | e43470cf6f3a7c965b7dc8a349593dadd03ee65e /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | |
parent | f41bebc843a8b4ab1ab29562ba200b032b5ab5ac (diff) | |
parent | 5377253612801b2f92e0b55e40c3ce0dd2574b09 (diff) |
Merge remote-tracking branch 'origin/6.0'
Conflicts:
cmake/QtCreatorIDEBranding.cmake
qbs/modules/qtc/qtc.qbs
qtcreator_ide_branding.pri
Change-Id: If8baed5564470e550a0ba5c7720915217eec2412
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 1dae931af3..d40d182126 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -777,6 +777,8 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen setMovable(true); } + markRepeaterParentDirty(); + ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty); if (!newParentInstance) @@ -841,6 +843,8 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q if (name == "layer.enabled" || name == "layer.effect") setAllNodesDirtyRecursive(quickItem()); + markRepeaterParentDirty(); + ObjectNodeInstance::setPropertyVariant(name, value); refresh(); @@ -860,6 +864,8 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q if (name.startsWith("anchors.") && isRootNodeInstance()) return; + markRepeaterParentDirty(); + ObjectNodeInstance::setPropertyBinding(name, expression); refresh(); @@ -937,6 +943,8 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name) resetVertical(); } + markRepeaterParentDirty(); + ObjectNodeInstance::resetProperty(name); if (isInLayoutable()) @@ -1013,6 +1021,35 @@ QQuickItem *QuickItemNodeInstance::quickItem() const return static_cast<QQuickItem*>(object()); } +void QuickItemNodeInstance::markRepeaterParentDirty() const +{ + const qint32 id = instanceId(); + if (id <= 0 && !isValid()) + return; + + QQuickItem *item = quickItem(); + if (!item) + return; + + QQuickItem *parentItem = item->parentItem(); + if (!parentItem) + return; + + // If a Repeater instance was changed in any way, the parent must be marked dirty to rerender it + const QByteArray type("QQuickRepeater"); + if (ServerNodeInstance::isSubclassOf(item, type)) + DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content); + + // Repeater's parent must also be dirtied when a child of a repeater was changed + if (ServerNodeInstance::isSubclassOf(parentItem, type)) { + QQuickItem *parentsParent = parentItem->parentItem(); + if (parentsParent) + DesignerSupport::addDirty(parentsParent, QQuickDesignerSupport::Content); + } +} + + + } // namespace Internal } // namespace QmlDesigner |