[solved] PySide subclassed QGraphicsItem not getting mouse events when used as module



  • I'm using Pyside to create an interactive subclassed QGraphicsView - containing some subclassed QGraphicsItems. It works well in its own module and receives mouse events.

    But when used as a module from another file, and incorporated into another Layout - my mouse events are not being triggered. However .itemChange is working. Everything except the mouse events. I am not using tracking events such as hover. I am using mousePressEvent and mouseReleaseEvent.

    I have seen c++ responses about setting "setMouseTracking" but this is for widgets and my QGraphicsItems have been added as items not widgets. So when I call this funcion it tells me it doesn't exist for items. Also that seems to be for hover type of events - which I am not needing. I believe I am subclassing properly and I pass on the events to the parent class. As I said at the start - my code works fine in a standalone file.

    Any ideas what I've forgotten to do ?

    The standalone - working program,
    the parent program - where it stops working,
    and the ui file it uses are all here (too big for this forum's guidelines):
    http://stackoverflow.com/questions/13696178/subclassed-qgraphicsitem-not-getting-mouse-events-when-used-as-module



  • This suggests a solution for keypress style events but not sure how to override mouse events for GraphicsItems.
    http://qt-project.org/forums/viewthread/21613/



  • Stupid error in my code where I, myself, on my own, disable my own widgets by setting inhibit_edit to True.
    Sigh...

    I need a bit of a lie down :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.