目前我正在使用QtQuick在Qt / Qml中进行开发。我来到了一个点,我需要找出我的场景中的一项是否在最上面。也就是说,我需要找出该项目是否具有最高的z坐标。我尝试使用childAt和mapToScene构建一个算法。事实证明,这是可怕的缓慢。然后我发现了itemAt()。不幸的是,它只在GraphicScene中可用,即在小部件世界中。
现在我的问题是:在QmlSceneGraph中有没有与itemAt()等价的函数?如果某项是最上面的项,我如何才能确定?我甚至不需要确切的z顺序,只是为了确保项目显示在顶部。
谢谢你的帮助。
来自德国的问候
发布于 2014-11-13 22:34:44
您可以使用Item::childAt(real x,real y)方法
ApplicationWindow {
id: root
visible: true
MouseArea {
anchors.fill: parent
onClicked: console.log(root.contentItem.childAt(mouse.x,mouse.y));
}
}https://stackoverflow.com/questions/26909085
复制相似问题