From 30065610816c55775ee95beb4487c9d00d7df5b8 Mon Sep 17 00:00:00 2001 From: Day0Dreamer Date: Sat, 27 Mar 2021 21:21:50 +0100 Subject: [PATCH] Bug fix proposal Suppose you type Lorem, try to exit, get Save as dialogue, close it and app closes on you. I think we should add a check about it (And give the book a fix too :)) --- src/07 Qt Text Editor/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/07 Qt Text Editor/main.py b/src/07 Qt Text Editor/main.py index 06caccf..e5be646 100644 --- a/src/07 Qt Text Editor/main.py +++ b/src/07 Qt Text Editor/main.py @@ -12,6 +12,8 @@ class MainWindow(QMainWindow): ) if answer & QMessageBox.Save: save() + if text.document().isModified(): + event.ignore() elif answer & QMessageBox.Cancel: e.ignore() @@ -76,4 +78,4 @@ def show_about_dialog(): about_action.triggered.connect(show_about_dialog) window.show() -app.exec_() \ No newline at end of file +app.exec_()