Open
Description
Attempting to send certain kwargs to QMessageBox will exception, while the stubs say it does support it. For example:
filepath_str, _filter = QFileDialog.getSaveFileName(self, "Save As", "", self._saveFilter, "")
if not filepath_str or not filepath_str.strip() or not os.path.exists(filepath_str):
QMessageBox(
icon=QMessageBox.Critical,
title="Failed to add resource",
text=f"Could not add resource at {filepath_str}: Choose a valid file.",
parent=None,
flags=Qt.Window | Qt.Dialog | Qt.WindowStaysOnTopHint,
).exec_()
The above code fails on PyQt5 but mypy does not catch it. The following works however:
filepath_str, _filter = QFileDialog.getSaveFileName(self, "Save As", "", self._saveFilter, "")
if not filepath_str or not filepath_str.strip() or not os.path.exists(filepath_str):
QMessageBox(
QMessageBox.Critical,
"Failed to add resource",
f"Could not add resource at {filepath_str}: Choose a valid file.",
parent=None,
flags=Qt.Window | Qt.Dialog | Qt.WindowStaysOnTopHint,
).exec_()
Metadata
Metadata
Assignees
Labels
No labels