From 1b93da5f11ef753577e7231cf9067b6edebb89d3 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Sat, 7 Dec 2013 21:09:17 +0100 Subject: [PATCH] Do not close window if it has childwindows --- game.py | 6 ++++++ windows.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/game.py b/game.py index 023dc9f..e7d0f03 100644 --- a/game.py +++ b/game.py @@ -96,6 +96,12 @@ class SeopardyGame(QtGui.QWidget): else: return super(SeopardyGame, self).event(e) + def closeEvent(self, event): + if not self._inOtherWindow: + event.accept() + else: + event.ignore() + def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Escape: self.close() diff --git a/windows.py b/windows.py index 657d7ca..6568855 100644 --- a/windows.py +++ b/windows.py @@ -203,6 +203,12 @@ class EditAnswersWindow(QtGui.QDialog): return qa + def closeEvent(self, event): + if not self._in_window: + event.accept() + else: + event.ignore() + def _setupGui(self): self.layout = QtGui.QVBoxLayout()