Browse Source

Do not close window if it has childwindows

Sebastian Lohff 6 years ago
parent
commit
1b93da5f11
2 changed files with 12 additions and 0 deletions
  1. 6
    0
      game.py
  2. 6
    0
      windows.py

+ 6
- 0
game.py View File

@@ -96,6 +96,12 @@ class SeopardyGame(QtGui.QWidget):
96 96
 		else:
97 97
 			return super(SeopardyGame, self).event(e)
98 98
 
99
+	def closeEvent(self, event):
100
+		if not self._inOtherWindow:
101
+			event.accept()
102
+		else:
103
+			event.ignore()
104
+
99 105
 	def keyPressEvent(self, e):
100 106
 		if e.key() == QtCore.Qt.Key_Escape:
101 107
 			self.close()

+ 6
- 0
windows.py View File

@@ -203,6 +203,12 @@ class EditAnswersWindow(QtGui.QDialog):
203 203
 
204 204
 		return qa
205 205
 
206
+	def closeEvent(self, event):
207
+		if not self._in_window:
208
+			event.accept()
209
+		else:
210
+			event.ignore()
211
+
206 212
 	def _setupGui(self):
207 213
 		self.layout = QtGui.QVBoxLayout()
208 214
 

Loading…
Cancel
Save