forked from qt-creator/qt-creator
QmlDesigner: Implement effect item visibility handling
Now effects made with effect composer can be hidden/shown using visible property. Fixes: QDS-11786 Change-Id: I44782246adfa3ba3cd0a8203fa67b3f5412535f7 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -583,9 +583,13 @@ import QtQuick
|
||||
Item {
|
||||
id: rootItem
|
||||
|
||||
// This is an internal property used by tooling to identify effect items
|
||||
// Use visible property to show and hide the effect.
|
||||
visible: true
|
||||
|
||||
// This is an internal property used by tooling to identify effect items. Do not modify.
|
||||
property var _isEffectItem
|
||||
|
||||
// This is an internal property used to manage the effect. Do not modify.
|
||||
property Item _oldParent: null
|
||||
)"
|
||||
};
|
||||
@@ -593,7 +597,7 @@ Item {
|
||||
s += header.arg(qApp->applicationVersion(), QDateTime::currentDateTime().toString());
|
||||
|
||||
if (m_shaderFeatures.enabled(ShaderFeatures::Source)) {
|
||||
s += " // This is the main source for the effect\n";
|
||||
s += " // This is the main source for the effect. Set internally to the current parent item. Do not modify.\n";
|
||||
s += " property Item source: null\n";
|
||||
}
|
||||
if (m_shaderFeatures.enabled(ShaderFeatures::Time)
|
||||
@@ -622,11 +626,26 @@ R"(
|
||||
}
|
||||
if (parent) {
|
||||
_oldParent = parent
|
||||
parent.layer.enabled = true
|
||||
parent.layer.effect = effectComponent
|
||||
if (visible) {
|
||||
parent.layer.enabled = true
|
||||
parent.layer.effect = effectComponent
|
||||
}
|
||||
%1
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
parent.layer.enabled = true
|
||||
parent.layer.effect = effectComponent
|
||||
source = parent
|
||||
} else {
|
||||
parent.layer.enabled = false
|
||||
parent.layer.effect = null
|
||||
source = null
|
||||
}
|
||||
parent.update()
|
||||
}
|
||||
)"
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user