Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37574

Wrong layout of items when using layer.enabled with Row/Column

    XMLWordPrintable

Details

    Description

      The rendering of a scene is wrong when applying a graphical effect on an item inside a positionner/layout trough the Item::layer.effect property.

      Test code:

      Row {
      
          Rectangle {
              width: 100
              height: 100
              color: "green"
      
              layer {
                  effect: ColorOverlay {
                      color: "red"
                  }
                  enabled: true
              }
          }
      
          Rectangle {
              width: 100
              height: 100
              color: "green"
      
              layer {
                  effect: ColorOverlay {
                      color: "blue"
                  }
                  enabled: true
              }
          }
      
          Component.onCompleted: {
      
              print("Children count : " + children.length)
      
              for(var i = 0 ; i < children.length; i++) print("|- " ,children[i])
          }
      }
      
      

      In this example I expect the rendering to be : .

      Instead I got a row like this :

      I tried to debug the row contents and it seems that there is in fact 6 children inside the row:

      Children count : 6
      |-  QQuickRectangle(0xcce188)
      |-  QQuickShaderEffectSource(0xccacb8)
      |-  ColorOverlay_QMLTYPE_1(0xccad18)
      |-  QQuickRectangle(0xd059c8)
      |-  QQuickShaderEffectSource(0xd099a8)
      |-  ColorOverlay_QMLTYPE_1(0xcc34b8)
      

      Attachments

        1. expected_result.jpg
          expected_result.jpg
          3 kB
        2. main.qml
          0.7 kB
        3. result.jpg
          result.jpg
          4 kB
        4. Sample_LayerEffect.qml
          0.7 kB

        Issue Links

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

          Activity

            People

              aalpert Alan Alpert
              x-krys Christopher Courtois
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes