Details
Description
Steps to reproduce:
- Left click
- Right click,. note error below
""" Repro: 1. Run `python tests/python/test_event_exception.py` 2. Right-click and nothing bad happens 3. Left click to cause exception 4. Right-click and see event exception """ from PySide2 import QtWidgets, QtCore class Widget(QtWidgets.QWidget): def mouseReleaseEvent(self, event): print("\nmouseReleaseEvent :: event type: %r" % type(event)) if event.button() == QtCore.Qt.LeftButton: raise Exception("FOO") def contextMenuEvent(self, event): print("contextMenuEvent :: event type: %r" % type(event)) super(Widget, self).contextMenuEvent(event) app = QtWidgets.QApplication(["event_repro"]) widget = Widget() widget.show() app.exec_()
The exception produced:
Traceback (most recent call last): File "tests/python/test_event_exception.py", line 38, in mouseReleaseEvent raise Exception("FOO") Exception: FOO
then causes the exception the next time right-click is pressed
Traceback (most recent call last): File "tests/python/test_event_exception.py", line 43, in contextMenuEvent super(Widget, self).contextMenuEvent(event) TypeError: 'PySide2.QtWidgets.QWidget.contextMenuEvent' called with wrong argument types: PySide2.QtWidgets.QWidget.contextMenuEvent(PySide2.QtGui.QMouseEvent) Supported signatures: PySide2.QtWidgets.QWidget.contextMenuEvent(PySide2.QtGui.QContextMenuEvent)
Attachments
For Gerrit Dashboard: PYSIDE-656 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
375022,11 | shiboken: fix missing cleanup in overridden virtual methods of wrappers | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
375657,7 | shiboken: do some cleanup for writeVirtualMethodNative before fixing | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
375706,4 | shiboken: do some cleanup for writeVirtualMethodNative before fixing | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
376199,3 | shiboken: fix missing cleanup in overridden virtual methods of wrappers | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |