PDA

View Full Version : Enabling/Disabling QGraphicsItem Selectability en masse



Goug
7th February 2012, 23:14
I have a QGraphicsScene with some items selectable and some items not selectable. We also use layers and all items in a layer are parented to the layer item (for showing/hiding layers). I have a situation where I would like to temporarily disable all selections on all items in the scene and then restore them.

Is it possible to do this at a high level so that the individual selectable flags aren't changed on the lower level items? Otherwise, I have to scan all of the items in the scene to disable selections, and then restore them in a similar fashion. It might be OK performance wise, but I'm concerned about it, plus if there's an easy way that I'm not seeing, I'd rather try that first.

Thank you,
Doug

wysota
8th February 2012, 01:03
You can reimplement mouse events for the view or the scene and call the base class implementation only if you want to allow selecting items.