事件与QGraphicsItemGroup [英] Events with QGraphicsItemGroup
本文介绍了事件与QGraphicsItemGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我想使用QGraphicsItemGroup将项目分组到一个项目中。
我玩了一点,不确定使用它,因为当我想抓住事件,事件合并在一起,但我想处理特定的事件与特定的孩子。
如何我可以实现这个吗?
In my application I want to use QGraphicsItemGroup for grouping items into one item.
I played with it a little and not sure using it because when I want to catch events, events are merged together but I want to handle specific event with specific child.
How can I achieve this?
推荐答案
您需要调用 QGraphicsItemGroup :: setHandlesChildEvents(false)
。这将停止 QGraphicsItemGroup
尝试处理该事件,并让孩子 QGraphicsItem
来处理它们。
You need to call QGraphicsItemGroup::setHandlesChildEvents(false)
. This stops the QGraphicsItemGroup
trying to handle the event, and lets the child QGraphicsItem
s handle them instead.
这篇关于事件与QGraphicsItemGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文