[Interest] Particles Emitter, emit signal when particle life is expired?

Sletta Gunnar Gunnar.Sletta at digia.com
Thu May 16 09:37:53 CEST 2013


On May 14, 2013, at 9:58 AM, Mark <markg85 at gmail.com> wrote:

> On Sun, May 12, 2013 at 2:08 PM, Mark <markg85 at gmail.com> wrote:
>> Hi,
>> 
>> I'm browsing through the Emitter API while searching for "some" way to
>> get notified when a particle is expired.
>> 
>> What i'm having is one emitter that emits 1 particle every 25ms then
>> one trailemitter that adds a trail to the particle. Now in the main
>> emitter (with 1 particle every 25 ms) i want to get notified when the
>> particle dies - which is 625 ms later. How can i do that?
>> 
>> I can probably play with the Timer element, but then i'd need a timer
>> for every particle which is quite a pain to do in QML in a dynamic
>> fashion.. I'm actually hoping there is a signal somewhere (or a
>> onSomething...) that i haven't found yet but can also be used to get
>> the same result.
>> 
>> If that doesn't exists then i guess i need to make a dynamic timer
>> element for QML, right?
>> 
>> The ideal thing - for me - to have here is a signal that fires with
>> the X and Y position where the particle expired.
>> 
>> Regards,
>> Mark
> 
> Anyone?

Tracking each individual particle is not really in line with the concept of a particle systems as they are typically set up as fire-and-forget to be as cheap and fast as possible.

However, there might be way that works for you, granted that you don't have too many particles live at the same time.

If you use the ItemParticle, you can specify a delegate for it. This delegate can be a normal Image {} item, and will be a lot slower (probably in the range 100-1000x worse) than plain a ImageParticle, but  you can then track it using the onVisibleChanged signal. When the item is visible, it is "alive" and when it is hidden its lifespan has ended.

cheers,
Gunnar

> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list