QmlDesigner: Remove "layer.enabled" when deleting effect

Task-number: QDS-3802
Change-Id: Ieb0e839e006c43be8f62318ffec06044eedefd78
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thomas Hartmann
2021-09-01 15:40:17 +02:00
parent b99d7623f3
commit 5e464155d9

View File

@@ -45,6 +45,8 @@
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#endif #endif
#include <utils/qtcassert.h>
#include <QRegularExpression> #include <QRegularExpression>
namespace QmlDesigner { namespace QmlDesigner {
@@ -356,6 +358,16 @@ static void removeAliasExports(const QmlObjectNode &node)
} }
static void removeLayerEnabled(const ModelNode &node)
{
QTC_ASSERT(node.isValid(), return );
if (node.parentProperty().isValid() && node.parentProperty().name() == "layer.effect") {
ModelNode parent = node.parentProperty().parentModelNode();
if (parent.isValid() && parent.hasProperty("layer.enabled"))
parent.removeProperty("layer.enabled");
}
}
/*! /*!
Deletes this object's node and its dependencies from the model. Deletes this object's node and its dependencies from the model.
Everything that belongs to this Object, the ModelNode, and ChangeOperations Everything that belongs to this Object, the ModelNode, and ChangeOperations
@@ -366,6 +378,7 @@ void QmlObjectNode::destroy()
if (!isValid()) if (!isValid())
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
removeLayerEnabled(modelNode());
removeAliasExports(modelNode()); removeAliasExports(modelNode());
for (QmlModelStateOperation stateOperation : allAffectingStatesOperations()) { for (QmlModelStateOperation stateOperation : allAffectingStatesOperations()) {