To use an event we have to make our own class that inherits the widget we want to use. Our class must have methods named as events that we want to use (like those two examples). Event object will be under the method argument. Here is an working example: We made our own class that inherits QListWidget, and we defined two methods for two events. QMouseEvent hidden under event argument contains such methods as "x()" and "y()" which contain the place location on the widget where the click/release occurred. The button() method will inform us which button was used. Also we use some QListWidget methods like very nice one: itemAt(X, Y), which will return the item if any under X, Y coordinates. We select the item we click on. Just save the code in a file and run it from a terminal - and when you click on an item - event messages will be printed there.
mouseReleaseEvent (self, QMouseEvent e) mousePressEvent (self, QMouseEvent e)