Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
PySide2 contextMenuEvent and mouseMoveEvent clash
Goffer last edited by A Former User
I'am trying to convert a UI from PySide to PySide2 but I am having a hard time with the contextMenuEvent. Everyything works fine with PySide but in PySide2 in some cases the events seems to be confused.
# Traceback (most recent call last): # File "/sw/dev/legoffl/pythonDev/picker.py", line 919, in mouseMoveEvent # super(PickerView, self).mouseMoveEvent(event) # TypeError: # 'PySide2.QtWidgets.QGraphicsView.mouseMoveEvent' called with wrong argument types: # PySide2.QtWidgets.QGraphicsView.mouseMoveEvent(PySide2.QtGui.QContextMenuEvent) # Supported signatures: # PySide2.QtWidgets.QGraphicsView.mouseMoveEvent(PySide2.QtGui.QMouseEvent)
From what I understand, It seems that the contextMenu event is still the one detected when the mouse is moving. This only happens for some entries of my menu. Now the question is WHY ? PySide version work perfectly. What has changed ???
Is tthere a new trick with PySide2 ???
@Goffer So, you're handling events by yourself? Can you show the code?
Goffer last edited by
Sorry, I am not allowed to share the code as it' company property.
I am simply subclassing a QGrapgicsView and overriding ContextMenuEvent and MouseMoveEvent to add some features, nothing fancy.
@Goffer Well, without code it is hard to help...