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.