ItemParticle QML Type
用于指定用于绘制粒子的委托。更多内容...
| Import Statement: | import QtQuick.Particles |
| Inherits: |
属性
方法
- void freeze(Item item)
- void give(Item item)
- void take(Item item, bool prioritize)
- void unfreeze(Item item)
详细说明
物业文件
delegate : Component
每个逻辑粒子都会创建一个委托实例,并随其一同移动。除了使用委托外,您还可以自行创建 Item 实例,并通过take 方法将其传递给ItemParticle 进行移动。
由ItemParticle 创建的任何委托实例,都将在逻辑粒子过期时被销毁。
fade : bool
如果为 true,该项将在生命周期结束时自动淡入淡出。如果为 false,则需自行实现任何出现效果。
默认值为 true。
方法文档
void freeze(Item item)
暂停由item 所代表的逻辑粒子的时间流逝,使您能够控制其运动。
void give(Item item)
命令“ItemParticle ”将“item ”的控制权移交给你。它将停止控制该物品,该物品也将失去与逻辑粒子的关联。
void take(Item item, bool prioritize)
请求ItemParticle 暂时接管item 的定位控制。当有逻辑粒子可用时,它将跟随该逻辑粒子的移动。
默认情况下,项目在等待逻辑粒子时会形成队列,但如果prioritize 是true ,则该项目将立即移至队列首。
ItemParticle 不会获取该项的所有权,并在逻辑粒子过期时放弃控制权。通常此时您会希望将其放回队列中,可在委托定义中使用以下代码行实现:
ItemParticle.onDetached: itemParticleInstance.take(delegateRootItem);或者将其删除,例如在委托定义中使用以下代码行:
ItemParticle.onDetached: delegateRootItem.destroy();void unfreeze(Item item)
重启由item 所表示的逻辑粒子的时间流,使其能够再次被粒子系统移动。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.