Are hover events propagated tree-wise in a QGraphicsScene?
-
I have set up a Qt 4.8 QGraphicsScene with a lot of items, and grouped those items into layers using a QGraphicsItemGroup per "layer" : that is, per set of related items. Items are added to groups, then the groups to the scene.
I want to enable hover actions for some items so in one item type (that I had already subclassed) I inherited the hover event functions, and in the constructor of those items enabled hover events.
Nothing happened. I found that the code that enables hover events on the scene itself only checks for the item being added wanting hover events, rather than the recursive check of its children you might expect.
So I enabled hover events on the groups - without implementing the event functions as there was no functionality needed - and while hover events now get called, the event handlers for the items I want aren't.
The construct I have is a space-wise tree - with large items overlaid by smaller ones. For example, large square image tiles overlaid by much smaller line and polyline objects. The group (layer) objects are normally all of a similar size (== the whole scene) - their actual size will depend on the distribution of items, but variation will be minor.
It seems to me that what I am seeing is that the code passing out hover events sees there are a number of items at a particular X,Y coord and picks the first one in the returned list - which may be but normally isn't an "interesting one". It seems to ignore the rest but pays a lot of attention optimising the one it picked...
I had expected that all the possible event handlers for a particular X,Y would be called...
Is my analysis correct and is there a solution?