eventFilter Function is stopping my Buttons to work

  eventfilter, events, pyqt5, pyside2, python

This is my eventFilter which i’m installing on main QWidget window.
It’s working to move my window with right button press. but I’ve some buttons on my Window which stops working and stays in selected phase after click on them.After removing this eventFilter, everything goes fine.
problem in buttons after eventFilter

def eventFilter(self, source, event):
        try:
            if (event.type() == QtCore.QEvent.MouseButtonPress and 
                event.button() == QtCore.Qt.RightButton):
                    self.startPos = event.pos()
                    return True
            elif event.type() == QtCore.QEvent.MouseMove and self.startPos is not None:
                self.move(self.pos() + event.pos() - self.startPos)
                return True
            elif event.type() == QtCore.QEvent.MouseButtonRelease:
                self.startPos = None
                return True
            
            return super(Ui_digiWidget, self).eventFilter(source, event)
        except Exception as e:print(e)

Source: Python Questions

LEAVE A COMMENT