Make QGraphicsItem non interactive with mouse.
I have a QGraphicsView with mouse interaction, mainly a rubberband selection that works just fine. Now I am trying to add a QGraphicsItem(we will name it Box) that will be a container for other QGraphicsItems.
So basically I need to be able to use my rubberband selection inside this Item (Box) as if I was directly in the scene.
I've tried to ignore some events (mousePress/Move/Release) inside the item (Box) hopping that it would then use the scene events. but it doesn't work. Ignore will should send towards the parentItem but the view not being a valid parentItem, my item (Box) doesn't have a parent
I just want my item (Box) to be treated as a background color, the item itself will be controlled via handles being children items.
How could I achieve this behaviour ?
Don't fiddle with events. Just indicate to the item that it should not receive them in the first place:
I've tried that too without success
Then you're doing something else wrong because that's all it takes. Can you compose a minimal code example of what you're doing?
My bad, I ve found the mistake, when designing the rubberband at the view level, I've added as a condition that there shouldn't be any item bellow the pointer ...
by commenting it out it works.
Just to make sure you're aware - QGraphicsScene has a built-in rubberband support.
There's no need to implement it manually:
Yeah I know, I ve re-implemented it because it didn't work 100% for what I'm doing