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

Software Renderer: Updating a layer-enabled subtree while it is invisible produces wrong outcomes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.14, 6.2.8, 6.5.1
    • Quick: 2D Renderer
    • Raspberry Pi 4 Model B, official Boot2Qt QBSP image, OR Windows 10 22H2 with software renderer

    Description

      Code

      // main.qml
      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Layouts 1.15
      import QtQuick.Shapes 1.15
      
      ApplicationWindow
      {
          id: root
          width: 640
          height: 480
          visible: true
          color: "black"
      
          property bool antialias: true // WORKAROUND: Make this `false`
          property int val: 0
      
          Item {
              id: gui
              anchors.fill: parent
      
              Column {
                  anchors.fill: parent
                  padding: 10
                  spacing: 10
                  Row {
                      padding: 10
                      spacing: 10
      
                      Repeater {
                          model: 10
      
                          Shape {
                              // This is a simplified version of SvgPathItem from Qt Design Studio:
                              // https://code.qt.io/cgit/qt-labs/qtquickdesigner-components.git/tree/src/imports/components/SvgPathItem.qml?h=qds-4.2
                              id: shape
                              width: 50
                              height: 50
      
                              antialiasing: root.antialias
                              layer.enabled: root.antialias
                              layer.smooth: root.antialias
                              layer.samples: root.antialias ? 4 : 0
      
                              ShapePath {
                                  strokeWidth: 0
                                  strokeColor: "transparent"
                                  fillColor: root.val > index ? "lime" : "grey"
                                  PathSvg { path: "M 0 0 H 50 V 50 H 0 Z" }
                              }
                          }
                      }
                  }
                  Text {
                      text: `${root.val*10} %`
                      color: "white"
                  }
                  Button {
                      text: "Reset"
                      onClicked: {
                          gui.visible = false // WORKAROUND: Comment out this line. Avoid changing values/colors while invisible
                          root.val = 0
                      }
                  }
              }
          }
      
          Timer {
              // Animate the progress bar
              interval: 200
              running: true
              repeat: true
              onTriggered: {
                  ++root.val
                  if (root.val > 10)
                      root.val = 0
              }
          }
          Timer {
              // Un-hide the progress bar after a short delay
              interval: 100
              running: !gui.visible
              repeat: true
              onTriggered: gui.visible = true
          }
      }
      

       

      Steps to Reproduce

      1. Build and run the attached project
      2. Observe the progress bar from 0% to 100% a few times
      3. Click the "Reset" button when the bar is around 50%
      4. Observe the progress bar from 0% to 100% a few times

       

      Expected behaviour

      The progress bar visually matches the percentage number on screen at all times.

       

      Actual behaviour

      When using the linuxfb platform plugin, the progress bar is visually frozen for a short while at Step #4. The behaviour returns to normal after the progress value reaches 50% (or whatever the value was when Step #3 was done).

      Non-linuxfb plugins are not affected. EDIT: ** No need for linuxfb – the softwarer renderer has the same issue 

       

      Possible workarounds

      • This issue does not occur if antialiasing is disabled (possibly related to multisample AA?)
      • This issue does not occur if we avoid updating any properties that result in visual changes while the Shape is invisible.

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes