Hello, i'm having trouble detecting the 'pressed' signal from a QGraphicsView using the signal/slots framework in PyQt4 (v4.5.4, Qt v4.5.2).
The attached code perhaps best illustrates my problem. The default event handler 'mousePressEvent' fires as expected, but the slot 'slotPressEvent' does not respond to the 'pressed' signal. Can anyone see what the problem is?
The workaround i'm currently using is commented out on line 13, emitting the 'pressed' signal from the 'mousePressEvent' handler. In my actual application I am also going to trap the 'released' signal on the QGraphicsView, which I am currently doing using the same workaround.
I expect i'm not understanding something about Qt's signals/events. Coming from experience with Javascript's various event listeners may have confused me as to how they actually work. In JS you can attach a single handler directly as a property of the object button.click, or multiple handlers using: button.addEventListener('click', function). I think of 'mousePressEvent' as being equivalent to button.click, and signals/slots to addEventListener. Is this right?
Bookmarks