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

First manually queued particle is ignored when spawning ItemParticle particles

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.0, 5.12.4, 5.13.0
    • Fix Version/s: None
    • Component/s: Quick: Particles
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      The first button press spawns a "dummy" particle, successive presses spawn particles as expected (overridden2, ...).

      It looks like QQuickItemParticle::updatePaintNode triggers a second add to m_loadables.
      This results in QQuickItemParticle::tick popping the (correctly) queued item from m_pendingItems which correctly sets the d->delegate. But then the second entry from m_loadables (same d instance) is handled which overrides d->delegate with the default delegate since m_pendingItems is empty now.

      I do not fully understand why the second add in updatePaintNode happens, but it seems to lead to this behaviour.

      Minimal example:

      import QtQuick 2.0
      import QtQuick.Window 2.12
      import QtQuick.Particles 2.0
      import QtQuick.Controls 2.0
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Rectangle {
              id: root
              anchors.fill: parent
      
              ParticleSystem {
                  id: particleSystem
              }
      
              Emitter {
                  id: emitter
                  system: particleSystem
                  emitRate: 0
                  lifeSpan: 3000
                  lifeSpanVariation: 500
      
      
      
                  acceleration: AngleDirection {
                      angle: 90
                      magnitude: 80
                  }
      
                  velocity: AngleDirection {
                      angle: -90
                      angleVariation: 15
                      magnitude: 100
                      magnitudeVariation: 50
                  }
              }
      
              ItemParticle {
                  id: itemParticle
                  system: particleSystem
      
                  delegate: Text {text: "dummy"}
              }
      
              Component {
                  id: component
      
                  Text {
                      text: "asdfsdfafsd"
                      ItemParticle.onDetached: destroy();
                  }
              }
      
              Button {
                  property int i: 0
                  onClicked: {
                      let particle = component.createObject(itemParticle);
                      particle.text = "overriden" + ++i
                      itemParticle.take(particle)
                      emitter.burst(1, 200, 200)
                  }
                  text: "spawn"
              }
          }
      }
      
      

        Attachments

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

          Activity

            People

            Assignee:
            w00t Robin Burchell
            Reporter:
            ablu Erik Schilling
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes