PDA

View Full Version : QGraphicsView mouseEvents...?



thill2708
29th November 2006, 21:08
Currently, I have a subclassed widget, which contains a QGraphicsScene and a QGraphicsView. I have yet to find a way (after copious searching) to handle the mouse clicks on the QGraphicsView. I would really like to not have to subclass the view just for this. QEventFilter does not seem to be working, it seems, and overriding the main class's mousePressEvent doesn't seem to be working either. What am I missing, here? What am I not seeing?

jpn
29th November 2006, 21:20
Install the event filter on the graphics view's viewport (http://doc.trolltech.com/4.2/qabstractscrollarea.html#viewport):

graphicsView->viewport()->installEventFilter(this);