Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116883 Qt Quick Shapes: Loading vector graphics
  3. QTBUG-125549

Fill transform does not always update correctly when switching renderer

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Invalid
    • P2: Important
    • None
    • Quick: Shapes
    • None

    Description

      Sometimes when switching between CurveRenderer and GeometryRenderer, the fillTransform does not get correctly set.

      Take the following example:

      import QtQuick
      import QtQuick.Window
      import QtQuick.Shapes
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Shape {
              id: shape
              preferredRendererType: curveRenderer.checked ? Shape.CurveRenderer : Shape.GeometryRenderer
              ShapePath {
                  fillColor: "red"
                  strokeColor: "transparent"
                  fillGradient: LinearGradient {
                      x1: 20
                      y1: 20
                      x2: 180
                      y2: 130
                      GradientStop {
                          position: 0
                          color: "blue"
                      }
                      GradientStop {
                          position: 0.2
                          color: "green"
                      }
                      GradientStop {
                          position: 0.4
                          color: "red"
                      }
                      GradientStop {
                          position: 0.6
                          color: "yellow"
                      }
                      GradientStop {
                          position: 1
                          color: "cyan"
                      }
                  }
                  fillTransform: transformed.checked ? PlanarTransform.fromRotate(-90.0, shape.width / 2, shape.height / 2) : Qt.matrix4x4()
                  PathPolyline {
                      path: [ Qt.point(40, 90),
                              Qt.point(150, 60),
                              Qt.point(250, 110),
                              Qt.point(300, 110),
                              Qt.point(200, 190),
                              Qt.point(40, 90)                      ]
                  }
              }
          }
      
          RowLayout {
              anchors.bottom: parent.bottom
              anchors.left: parent.left
              anchors.right: parent.right
      
              CheckBox {
                  id: transformed
                  text: "Transformed"
              }
      
              CheckBox {
                  id: curveRenderer
                  text: "Curve Renderer"
              }
          }
      }
      

      Run it and check the "transformed" check box to rotate the gradient. Then check the "Curve Renderer" box to switch renderer. The transform goes back to the original and you have to uncheck and recheck the transformed box to get it correct.

      The same happens when switching back to GeometryRenderer.

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes