Move QGraphicsScene when clicking on an unmovable QGraphicsItem
I have the following Situation:
I have a custom GraphicsScene (which inherits from QGraphicsScene) to add custom items (which inherit from QGraphicsItem). One of these items is only an unmovable item with an image which is displayed behind all other items. I also have another image as background of the scene, so both images (the background image and the item image) are fixed.
When I click on the background I can move the scene around (within the ScrollArea) and when I click on the item and move it, nothing happens, which is absolutely correct.
So, is there any way that the item behaves as the scene background, e. g. when I click the image item I can move the scene around?
Hi and welcome
I wonder if you can set
setAttribute( Qt::WA_TransparentForMouseEvents );
on the images QGraphicsItem so they are "transparent" for events.
this is not possible, because the QGraphicsItem is not a QWidget. The same for QGraphicsObject. This is a QObject but not a QWidget.
Oh. ofc not.
Have you tried with
this is exactly what I was looking for.