From 72d623eeeb8d79c7c80d63ca09acaf1d0dc59f4a Mon Sep 17 00:00:00 2001 From: bsimmons01 Date: Sat, 20 Mar 2021 09:18:00 -0400 Subject: [PATCH] Explicit modality set when "New..." is selected The popup that happens for entering a category when "New..." is selected is currently NOT modal, despite line 14 stating "modal=True" I tested it on Ubuntu, Windows 10 and macOS (Big Sur). All of them showed the category dialog and you could put in the background and return to the main calendar window, which wouldn't be the correct behavior. Adding this line before the show command: self.setWindowModality(qtc.Qt.ApplicationModal) Makes it so the Category dialog is modal. Tested on Windows, Ubuntu, and macOS. --- Chapter03/calendar_app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Chapter03/calendar_app.py b/Chapter03/calendar_app.py index 1a1540a..274f2e8 100644 --- a/Chapter03/calendar_app.py +++ b/Chapter03/calendar_app.py @@ -33,6 +33,7 @@ def __init__(self): clicked=self.close ) self.layout().addWidget(self.cancel_btn) + self.setWindowModality(qtc.Qt.ApplicationModal) self.show() @qtc.pyqtSlot()