qt - QML:使用 NodeInstantiator 实例化时未触发 Scene2D 单击事件
问题描述
我正在创建一个 3D QtWayland 合成器,当将 ShellSurfaceItems 放在 Qt3D 平面上时,我使用 NodeInstantiator。这样做会注册除我的 Scene2D 上的实体之外的所有属性(我用来在 3D 平面上显示 2D ShellSurfaceItem)
我已经尝试了从加载组件时设置实体属性到手动实例化我的自定义面板组件(所有 QML)的所有方法。实体根本不链接到 Scene2D 中的事件处理程序
节点实例化器:
NodeInstantiator {
model: shellSurfaces
Panel {
id:panel
shellSurf: modelData
listIndex: index
}
}
面板.qml:
Entity {
...
id:panel
components: [panelTransform, planeMesh, material, panelPicker]
...
Scene2D {
id: waylandScene
output: RenderTargetOutput { ... }
mouseEnabled: true
entities: [parent]
ShellSurfaceItem { ... }
}
...
}
该程序应该在创建面板时将 Scene2D 单击处理程序链接到 Scene2D 类中的 ObjectPicker。然而,这并没有完成,因为 Scene2D 在entities
属性更改时从不执行其内部方法。
解决方案
推荐阅读
- java - 为什么 JobScheduler 立即启动?
- python - 无法使用 pip 安装任何东西 - 缺少 colouredlogs/METADATA
- java - 使用@RequestHeader("Authorization") 参数但不在方法体中使用?
- c - 创建用户登录后如何编程创建新的显示菜单选择?
- r - 分段函数的分段回归:开始 psi 超出允许范围
- php - TYPO3 9.5 中自定义页面 doktype 的站点路由
- java - JPA 多对多列表为空
- passkit - “文件‘pass.json’无法打开,因为没有这样的文件。”
- java - 将 ARGB 用于 google circle 是错误的
- angular - 如何显示外键相关的数据