Hi there.
I’m trying to call two different functions with left click and right click on a QPushButton.
I tried overriding “mousePressEvent” in my “QDockWidget” class with limited success.
def mousePressEvent(self, event):
super().mousePressEvent(event)
if event.type() == QtCore.QEvent.MouseButtonPress:
if event.button() == QtCore.Qt.RightButton:
print ("RightButton ")
elif event.button() == QtCore.Qt.LeftButton:
print ("LeftButton" )
The QpushButtonCode is:
theButton5_tab1=QtWidgets.QPushButton(“RightClickTest”)
theButton5_tab1.clicked.connect(theButton5_tab1.clicked)
The problem is that when I right click function runs as expected and prints the string. But when I left click 3ds max crashes.