Is it possible to have an event filter on a QGraphicsItem? Eventfilter has a param that gives you a QObject, but since QGraphicsItem isn’t derived from QObject, then how would it work?
Is it possible to have an event filter on a QGraphicsItem ? Eventfilter has
Share
Edit: Use QGraphicsItem::installSceneEventFilter as suggested in @Frank’s answer. Example:
The first thing that popped into my mind was this:
Create a new class, derived from both
QGraphicsItemandQObject, since these are unrelated (as far as a glance at the docs tells me), you should have what you wanted.…. But then I looked at the docs more closely and found QGraphicsObject, which is probably exactly what you want, it even already has the member
eventFilter