I have a window with FramelessWindowHint. I also have a QMenuBar attached to the QMainWindow. I want to grab mouse press events when the user clicks the menubar. I thought I could make a new class like so:
class menubarclass(QtWidgets.QMenuBar):
def __init__(self, parent):
super().__init__(parent)
Then reimplement the mousePressEvent function in that class.
def mousePressEvent(self, event):
print("menubar clicked")
The problem is that reimplementing this function seems to override the functionality of menus/actions in the menubar - I can't click them.
So I'm thinking I need to decorate the mousePressEvent rather than reimplement it, but I'm not sure how to do it, because this is an event handler.
In short, I don't want to override the mousePressEvent handler, but add additional code to it, if that makes sense?