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

First manually queued particle is ignored when spawning ItemParticle particles

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.0, 5.12.4, 5.13.0
    • Quick: Particles
    • None
    • 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

            w00t Robin Burchell
            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