2
0
mirror of https://github.com/pyqt/examples.git synced 2025-08-30 21:35:08 +00:00

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 :))
This commit is contained in:
Day0Dreamer
2021-03-27 21:21:50 +01:00
committed by GitHub
parent 5225c0e7f0
commit 3006561081

View File

@@ -12,6 +12,8 @@ class MainWindow(QMainWindow):
) )
if answer & QMessageBox.Save: if answer & QMessageBox.Save:
save() save()
if text.document().isModified():
event.ignore()
elif answer & QMessageBox.Cancel: elif answer & QMessageBox.Cancel:
e.ignore() e.ignore()
@@ -76,4 +78,4 @@ def show_about_dialog():
about_action.triggered.connect(show_about_dialog) about_action.triggered.connect(show_about_dialog)
window.show() window.show()
app.exec_() app.exec_()