diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2021-08-26 15:47:56 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2021-08-30 12:07:06 +0000 |
commit | 870b619c856b49003cc8e4aac554d537e5505117 (patch) | |
tree | c85b2bb900f262515e272add8911082c8bd40696 /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | |
parent | 3945868670238358d8733fad71264f2a9996d3bd (diff) |
QmlDesigner: Render effects on document level
Rendering effects requires actually rendering another item.
The effect is defined by another item that is rendered instead
of the original item.
For items that have an effect we do not render the children, since
the effect is only applied to the layer not the individual items.
We set layer.enabled temporarily to false, this ensures the effect
is not rendered as part of its parent item.
To detect the effect we use the source property an check if it points
to the ShaderEffectSource.
If one of the children inside the effect is transformed we have
to update the effect item.
If layer.enabled or layer.effect is changed we set the dirty flag
on the item and all children.
Change-Id: Iff61ef950e62a7a598b4bfa181ea70cb144368f3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 33bc2ee156..7557e87cce 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -612,6 +612,18 @@ void QuickItemNodeInstance::updateAllDirtyNodesRecursive(QQuickItem *parentItem) updateDirtyNode(parentItem); } +void QuickItemNodeInstance::setAllNodesDirtyRecursive(QQuickItem *parentItem) const +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + Q_UNUSED(parentItem) +#else + const QList<QQuickItem *> children = parentItem->childItems(); + for (QQuickItem *childItem : children) + setAllNodesDirtyRecursive(childItem); + DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content); +#endif +} + static inline bool isRectangleSane(const QRectF &rect) { return rect.isValid() && (rect.width() < 10000) && (rect.height() < 10000); @@ -813,6 +825,9 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q if (name == "y") m_y = value.toDouble(); + if (name == "layer.enabled" || name == "layer.effect") + setAllNodesDirtyRecursive(quickItem()); + ObjectNodeInstance::setPropertyVariant(name, value); refresh(); @@ -882,6 +897,9 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name) if (name == "y") m_y = 0.0; + if (name == "layer.enabled" || name == "layer.effect") + setAllNodesDirtyRecursive(quickItem()); + DesignerSupport::resetAnchor(quickItem(), QString::fromUtf8(name)); if (name == "anchors.fill") { |