Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
QDS 4.7.0
-
None
Description
The QML code generated by the effect composer can be improved by making it more readable. For instance such code:
function setupParentLayer() { if (_oldParent && _oldParent !== parent) { _oldParent.layer.enabled = false _oldParent.layer.effect = null source = null _oldParent.update() _oldParent = null } if (parent) { _oldParent = parent 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() } }
Can be roughly written as
Binding { when: rootItem.parent && visible target: rootItem.parent property: "layer.enabled" value : true } Binding { when: rootItem.parent && visible target: rootItem.parent property: "layer.effect" value : effectComponent }
Impact/Value:
- Helps to remove unnecessary internally-used properties
- Makes the more readable
- Makes the code easier to maintain
- Complies with the "declarative" nature of QML.
Suggested Solution:
There seems to be quite a few of different combinations of generated code. Generated functions can be identified in the generator source code and replaced with a more readable and declarative alternatives.
Attachments
Issue Links
- resulted in
-
QDS-15040 Improve code generation mechanism
-
- Reported
-