Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7.0
-
None
-
-
f86293210 (dev), 4a04afc95 (dev), 152ec44d1 (dev), bd786b82c (6.7), 52f5da392 (6.7), 46ea5407a (6.7), 0e107b7ec (dev), 9f09e1dda (dev), 99ea7ac4f (6.7), 3bfce0de3 (6.7), ce2959ec5 (dev), dcb3aa5de (dev), b5cbb40f4 (dev), ae23c335e (dev), a47ed06d1 (6.7)
Description
In PySide 6.7.0, I am no longer able to get the file path from a QFileOpenEvent. In particular, when I try to cast the event using e.g.
def event(self, evt): """ Handle an application-level event """ LOGGER.debug("Event: %s %s", evt, evt.__dir__()) if evt.type() == QtCore.QEvent.Type.FileOpen: url = QtGui.QFileOpenEvent(evt).url() LOGGER.debug("Got file open event: %s %s", url, url.toLocalFile()) #self.open_file() return True return super().event(evt)
I get an error:
Traceback (most recent call last): File "/Users/fluffy/projects/bandcrash/bandcrash/gui/__init__.py", line 911, in event url = QtGui.QFileOpenEvent(evt).url() ^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'PySide6.QtGui.QFileOpenEvent.__init__' called with wrong argument types: PySide6.QtGui.QFileOpenEvent.__init__(QEvent) Supported signatures: PySide6.QtGui.QFileOpenEvent.__init__(PySide6.QtGui.QFileOpenEvent) PySide6.QtGui.QFileOpenEvent.__init__(str) PySide6.QtGui.QFileOpenEvent.__init__(Union[PySide6.QtCore.QUrl, str])
I can't seem to figure out how to actually get the QFileOpenEvent from the QEvent, and the documentation isn't being particularly helpful here.
Attachments
Issue Links
- is duplicated by
-
PYSIDE-2718 PySide6.QtGui.QInputEvent is missing method matches (and key) in release 6.7.0
- Closed
-
PYSIDE-2757 event passed to custom "showEvent" is a "QtCore.QEvent" instead of the expected "QtGui.QShowEvent"
- Closed
-
PYSIDE-2763 eventFilter get instance of base QEvent type, instead of QDragEnterEvent, QDropEvent
- Closed
- relates to
-
PYSIDE-1214 Type issues when returning C++ classes which subclass Qt types
- Closed
- mentioned in
-
Page Loading...