File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -34,20 +34,10 @@ def __init__(self, parent: Optional[QtWidgets.QWidget] = None) -> None:
3434
3535 self .setMinimum (0 )
3636 self .setMaximum (0 )
37- self .setCancelButton (None ) # type: ignore[arg-type]
3837
39- def closeEvent (self , event : QtGui .QCloseEvent ) -> None :
40- # Ugly but not all platforms support having a frame and no close button
41- event .ignore ()
42- return
43-
44- def keyPressEvent (self , event : QtGui .QKeyEvent ) -> None :
45- if event .key () == QtCore .Qt .Key .Key_Escape :
46- # Disable closing dialog with Escape
47- event .accept ()
48- return
49-
50- super ().keyPressEvent (event )
38+ # Pressing the "Cancel" button emits `canceled`, pressing Escape emits
39+ # `rejected`, so simplify to a single signal.
40+ self .rejected .connect (self .canceled .emit )
5141
5242
5343class InvalidProjectFileDialog (QtWidgets .QMessageBox ):
You can’t perform that action at this time.
0 commit comments