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

ShapePath: Switching from a transparent colour to a non-transparent one causes the wrong colour to be displayed

    XMLWordPrintable

Details

    • 650e7d47f (dev), b0e3fe19f (6.5), f11d719ca (6.4), 8fdcbd60e (tqtc/lts-5.15), f6576ccb2 (tqtc/lts-6.2)

    Description

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Shapes 1.15
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
      
          property color displayColor: "yellow" // Should only show at startup
      
          ComboBox {
              model: ["red", "lime", "blue", "transparent"]
              onActivated: root.displayColor = currentText
          }
      
          Rectangle {
              anchors.centerIn: parent
              height: 100
              width: 100
              color: root.displayColor
          }
      
          Shape {
              anchors.fill: parent
      
              ShapePath {
                  strokeColor: root.displayColor
                  strokeWidth: 4
                  startX: 0
                  startY: root.height
                  PathLine { x: root.width; y: 0 }
      
                  onStrokeColorChanged: console.log("strokeColor:", strokeColor)
              }
          }
      }
      

       

      Steps to reproduce

      1. Run the code above
      2. Select different entries from the ComboBox to change the Rectangle and ShapePath colours

       

      Outcomes

      • The Rectangle always follows the selected colour. (Expected)
      • The ShapePath mostly follows the selected colour. However, every time we switch from "transparent" to a non-transparent colour, ShapePath becomes yellow instead of the selected colour. (Not expected)

       

      Workarounds

      • Instead of "transparent", use an almost-transparent colour such as "#01000000", OR
      • Use QQuickWindow::setSceneGraphBackend("software")

       

      Notes

      • This issue occurs when hardware acceleration is enabled: both RHI and traditional OpenGL (Qt 5.15)
      • This issue occurs on multiple RHI backends (tested on OpenGL, Vulkan, D3D11)

      Attachments

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

        Activity

          People

            lagocs Laszlo Agocs
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews