Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-15039

Improve effect composer generated code

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • QDS 4.7.0
    • Effect Composer
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              mabadri Mahmoud Badri
              soarmin Soheil Armin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes