[PyQt] connection to QGraphicScene mouse button event

Attila Csipa pyqt at csipa.in.rs
Thu Jul 9 18:02:23 BST 2009


On Thursday 09 July 2009 17:34:18 TheLonelyStar wrote:
> I have a QGraphicScene and I want to connect to its "mousePressEvent".
> I tried:
>
> self.connect(theScrene,QtCore.SIGNAL('mousePressEvent()'),self.sceneClicked
>)
>
> But I do not get the events.

Correct, the events are not signals (you're missing a parameter, though).

> Is there another way than subclassing from QGraphicScene?

Depending on what do you want, overriding the mousePressEvent is sometimes 
enough... A 'theScrene.mousePressEvent = self.sceneClicked' type of thing. 
We're using a dynamic language after all :)




More information about the PyQt mailing list