1#self.window.installEventFilter(app) needs to be run first for this to work
2#where window is the name of the QMainWindow and app is QApplication
3
4
5def eventFilter(self, source, event):
6 if event.type() == QtCore.QEvent.MouseMove:
7 if event.buttons() == QtCore.Qt.NoButton:
8 print("Simple mouse motion")
9 elif event.buttons() == QtCore.Qt.LeftButton:
10 print("Left click drag")
11 elif event.buttons() == QtCore.Qt.RightButton:
12 print("Right click drag")
13 elif event.type() == QtCore.QEvent.MouseButtonPress:
14 if event.button() == QtCore.Qt.LeftButton:
15 print("Press!")
16 return super(Window, self).eventFilter(source, event)